From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

storage an array with data

goal: storage an array with all the data.
 
I try to do one program and I need storage in one different place the data that I obtain call a sensor temperature. e.g: I call my program and I obtain one data, then I call my program again and I need storage the data in the same array but in other place.
How could I make this?
How can I create an array that storage all the data in the differents call to my program? Could be with one global variable?
How can I storage the data in different place of this array? Because I'm trying to do it and I'm be able to storage only in the first part of the array and this means that each time that I storage data I remove the all data and this is not that I need.
Thanks a lot
Gonzalo
0 Kudos
Message 1 of 3
(2,217 Views)

You would probably be best off using a "Functional Global" rather than a regular LabVIEW global.

A Functional Global is just a subVI with a while loop that has a shift register and a Case structure in the loop. Your data is stored in the shift register and the Case structure contains any number of states to manipulate the stored data.

I've attached a very simple example that can initialize your data, read, write and one case that can insert data anywhere in an array.

The advantage of using this over a regular global is better memory handling and it avoids the possibilities of race conditions that you must consider for regular globals. Also, since it's just a VI, you can add any number of cases to do whatever you need it to do.

As long as you do not make this VI re-entrant, anywhere you use it will be working on the same data set.

Ed

Message Edited by Ed Dickens on 11-28-2006 12:50 PM



Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
0 Kudos
Message 2 of 3
(2,203 Views)

Thank you very much ED,

I am going to try to use it.

Thanks again

Gonzalo

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