LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with analysing of upcoming data

I have a VI which gets data from the device every 2 seconds with the loop. After that this data goes to the TXT file - 2 columns (time and value from the device).

It works fine. But I need to add next thing. I need to get mean of last 30 points and mean of previous 31-90 points and compare them. If the difference is small then I need to exit the loop. I think there is 2 ways: get last 90 points from the file to array each 2 seconds and analyse it, but I don't know how to get last data from the growing file.

Second - is to put the upcoming data to the file and to the array at the same time. But I don't know how to keep the size of array equal to 90 points (I need to delete first value, move 89 values to the beginning, and put on 90th place new data).

Any suggestions on how to do it?

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

The later versions of LV have a limited size queue which might work for you.  Set the queue size to 90. The Queue Status function lets you get all the dat in the queue at once.

 

Lynn

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

@paly4 wrote:

I have a VI which gets data from the device every 2 seconds with the loop. After that this data goes to the TXT file - 2 columns (time and value from the device).

It works fine. But I need to add next thing. I need to get mean of last 30 points and mean of previous 31-90 points and compare them. If the difference is small then I need to exit the loop. I think there is 2 ways: get last 90 points from the file to array each 2 seconds and analyse it, but I don't know how to get last data from the growing file.

Second - is to put the upcoming data to the file and to the array at the same time. But I don't know how to keep the size of array equal to 90 points (I need to delete first value, move 89 values to the beginning, and put on 90th place new data).

Any suggestions on how to do it?


You say the file is growing?  Does it continue to add new data past 90 points?  If so, it would be easier to store the last 90 measurements/data points to an array and process it from there.  Take a look at the two VIs attached.  Maybe this will help.

-----------------------------------------------------------------------------------------
Reese, (former CLAD, future CLD)

Some people call me the Space Cowboy!
Some call me the gangster of love.
Some people call me MoReese!
...I'm right here baby, right here, right here, right here at home
Download All
0 Kudos
Message 3 of 3
(2,427 Views)