LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

fundamental array operation and re-use

I apologize if this is covered elsewhere. I understand how to make an array (build) in Labview.
Where I'm confused is .. let's say I have a big while loop and when the operator presses a button I want to peform some function, (sequence). then finish, then end up back so it can be done again ..
If I needed an array, where would this be created? Before the while loop? If so, let's say the sequence filled the array. then i used the data and was finished.. The next time the operator clicked the button, I would want to clear the array and refill it.. re-use it, etc..
If I put "initialize array" into the sequence, does it keep creating a new array so I would run out of memory? Or is it better to initialize the array at the beginning of program run and keep it "open" for use?
 
Not sure if this is clear. The examples show building an array by just wiring the output of a while loop. Does this have to be done every time some piece of code is excecuted?

Here's my basic function.
 
While loop waits for operator to press button
Operator presses button..
Test is performed and data is put into an array  of  multidimensions. some text some numbers (if this is possible)..
format is "Time/Date", Number, Number, Floating point number, Number, Number..
After the array is filled. (Not sure of the exact size, it will be different every time) I will manipulate the data and do some other stuff to the numbers.
At that point I will write all this data into a csv or space delimited file.

Then I want to be back at the starting point. But what just happened to my array data and what happens to it on the next iteration?


Jeff
0 Kudos
Message 1 of 4
(2,598 Views)
I attached a vi that i think will work for your situation.  Basically the easiest way that i can think of to do your test is to create a state machine, and when you want to acqurie data, go to a clear array state and then start acquiring your data. 

the vi is not complete by no means, but it should get you started.  you will also need to play with the time/date string to get it to display the correct time, currently it only gives you the hour in a dbl.

Kenny
Kenny

Download All
Message 2 of 4
(2,580 Views)
Hi Jeff,

dataflow should make this clear: You create data, work with data and 'throw them away' (LabView's internal garbage collection should do this).
Once the data wire ends, the data will be 'lost'/deleted from memory.
You can create/work/delete data in every loop, LabView is smart enough to release memory...
You can also make an array before the loop starts, fill the array and clear it after your sequence. Use a shift register to use that array again.
Everything is possible with LabView 🙂
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 4
(2,577 Views)
This link is about memory management in LabVIEW. It is not focused directly on arrays but there alot of time given array usage and how to work with them in loops most effieciently.

http://zone.ni.com/reference/en-XX/help/371361A-01/lvconcepts/vi_memory_usage/

Rick Kuhlman
Applicaitons Engineer
0 Kudos
Message 4 of 4
(2,537 Views)