LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

make calculations on acquired data

Dear fourm members,

 

I am reading analoge data using DAQmx Read vi and I want to plug it into waveform chart, before that I want to do some mehtimatical operation on the values of waveform.

 

Here is what I want to do 

 

Capture.PNG

 

I believe that what I did above is wrong because it is going to do the calculation on all values inside waveform (dt - t0 - Y) and I want to do it only on wavform values (Y). 

So, how to do the calculation correctly knowing that the data that coming out from this DAQmx Read VI is 1D array of waveform.

 

Thank you 

0 Kudos
Message 1 of 6
(2,814 Views)
0 Kudos
Message 2 of 6
(2,805 Views)
A simple mathematic operation will only modify the y array. This is trivial to verify yourself.
Message 3 of 6
(2,791 Views)

Thank you 

 

I read it but I am dealing with 1D array of waveform so I cant use get wavefront directly and also I want to know if my code in the picture calculate the values correctly or not.

 

and if it is ntot correct what is the alternative solution in my case

0 Kudos
Message 4 of 6
(2,786 Views)
Impossible to say if it's correct since no one knows what it supposed to do. You probably need to use the index array to modify a specific waveform but that's a guess and nothing to do with your first assumption.
0 Kudos
Message 5 of 6
(2,778 Views)

@xGlories wrote:

Dear fourm members,

 

I am reading analoge data using DAQmx Read vi and I want to plug it into waveform chart, before that I want to do some mehtimatical operation on the values of waveform.

 

Here is what I want to do 

 

Capture.PNG

 

I believe that what I did above is wrong because it is going to do the calculation on all values inside waveform (dt - t0 - Y) and I want to do it only on wavform values (Y). 

So, how to do the calculation correctly knowing that the data that coming out from this DAQmx Read VI is 1D array of waveform.

 

Thank you 


Am I correct that the function you wish to compute on each sample (which I will call S) is 1000000 * (4S / 2.1*(2S + 1))?  That seems to be the function in the picture (why do people attach pictures of code instead of code or code+pictures = snippets?). 

 

If so, there are only a few details for you to work out.

 

  1. How to handle an Array (size unspecified) of Waveforms.  What do you know about dealing with Arrays, and especially how they work with For loops?
  2. How to work with the "data" part of a Waveform.  If you don't know how to do this, you could (a) look for help and learn about Waveforms, clusters, etc., (b) look for examples using Waveforms, or (and probably the best way to learn and remember) (c) design an "Experiment" for yourself where you write a tiny Test VI that includes a Very Simple Waveform (perhaps all zeros, or 1,2,3,4,5) that you generate "by hand" and try to manipulate (try multiplying by 2) and observe the results, seeing what changes.
  3. While multiplication by a scalar of a Waveform (or array) and addition of Waveforms (or arrays) may seem mathematically tractable, what about multiplication or division of two Waveforms (or arrays)?  Is this done "point-by-point" or "mathematically" (where multiplying two 1-D arrays gives you a 2-D array)?  Again, an Experiment (a tiny VI example that you write and test) will reveal the answer very quickly.  It will also help you to learn LabVIEW better and faster.

P.S. -- I didn't know the answer to #3 "off the top of my head", but I followed my own advice, and now I'll never need to ask this again about LabVIEW ...

 

Bob Schor

Message 6 of 6
(2,741 Views)