LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Insert values into array, and repeat while keeping original

Hello,
 
I'm currently trying to determine a subject's heart rate, respiration rate, etc by using a LV (8.0) program provided by the instrument's manufacturer. This program is VERY "beta version", so to speak, and most attempts to modify it have resulted in disaster.
 
The way it works is: it takes 128 data samples (at 2046Hz, so it's a lot of data), and after reaching 128 it discards the data and starts taking another batch of 128.
 
What I would like to do is to take the first 128 points, save them to an array from n=0 to n=127, and after it obtains the next 128 points, record these from n=128 to n=257, and so on. If anyone has any suggestions on a better way to do this, I would greatly appreciate it.
 
I may add that I can't quite post a screenshot of the program due to a nondisclosure agreement. I will give further info as needed. Thank you very much in advance!
Message 1 of 4
(2,473 Views)
When you say "save them to an array", do you want to save them to a file, just keep them in memory or display a little bit of history?

If you want to keep them in memory then you will need to consider how long the vi will be running for.
If you just keep adding to an array at 2KHz you'll eventually run out of memory.
(2046 x 8bytes = ~ 16K per second or 58MB an hour)
Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
Message 2 of 4
(2,468 Views)


Lucazzo wrote:
What I would like to do is to take the first 128 points, save them to an array from n=0 to n=127, and after it obtains the next 128 points, record these from n=128 to n=257, and so on. If anyone has any suggestions on a better way to do this, I would greatly appreciate it.
Just keep your array in a shift register or feedback node and append the new data using "built array" in concatenate mode.
 
Be aware that you'll soon run into memory issues as the previous poster already mentioned. The situation is much easier if you have a fixed number of iterations and thus know the final array size beforehand. So please tell us a bit more about the details.
 
Another solution would be to stream the data to disk and, at the same time, display it in a chart containing a reasonable history lenght.
Message 3 of 4
(2,466 Views)

Yes, I had actually taken the memory issues into account. I didn't know whether to worry about it or not, but I will take your advice and try to solve them before they give me more trouble.

So, to further explain the purpose of the program:

1) Data is acquired from an encoder that samples at 2046Hz, on four channels (yeah, when you multiply the memory needed x4 it's even worse!)

2) Data is displayed. Currently, up to 128 are displayed due to the program's limitations (which I cannot change)

3) What I wish to do is have about 4 minutes of data acquired available at a time (in an array, perhaps?). After these 4 or so minutes are up, another 4 minutes are temporarily stored. All data taken for the duration of the experiment (~1 hour) must be saved on disk for later analysis. In short, I need to do real-time analysis on batched of 4 minutes, but require all of the data to be saved to disk (preferably .xls)

Thanks for the help. You've actually cleared my head quite a bit!

Luca

0 Kudos
Message 4 of 4
(2,433 Views)