LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to take waveform chart data and put it into an array

Hello all,

 

I am new to programming in Labview, and am learning basically by watching youtube video and such. My question is how to take a set of random data that I have written code for and linked to a waveform chart, and put the data into an array so I can calculate the mean of the data set. If there is an easier way to calculate the mean of the data set I am all ears, but I need to be able to display the mean on the front panel each time the code is run. I have attached a file of my code.

 

Thanks

0 Kudos
Message 1 of 3
(2,858 Views)

Welcome.

 

If you have not done so, look at the on-line tutorials on Getting Started with LabVIEW on the NI web site.

 

A chart has a property known as History which retains some previous values.  You can get access to the the History property by popping up on the block diagram terminal of the chart and selecting Create >> Property Node. Note that the history length can be set via a pop up menu.  The default length is 1024.

 

Other comments: When you know the number of iteration in advance you should use a for loop rather than the while loop.

You can also use an autoindexing tunnel at the boundary of the loop to create an array. It only contains the values from the current run, unlike the chart history which can retain values between runs (as long as the VI remains in memory). Watch the two Mean indicators as you run this VI several times.

The error wire is to assure that the history property node runs after the loop.  Disconnect the wire and watch the Mean and Mean 2 indicators carefully.

The Wait is to slow things down a bit so that you can see what is happening.

 

Lynn

0 Kudos
Message 2 of 3
(2,850 Views)

Thank you...was able to use your comments to finish out my project

0 Kudos
Message 3 of 3
(2,838 Views)