05-20-2013 09:59 PM
Hey Guys,
I could you some advice and direction. I'd like to write a Vi that will do the following:
In data enter mode:
Write a string and have it added to the top of an array
In Data sort mode:
Go through all the strings in the array from the first element to the last element and allow you to choose to send it to the last position or have it stay where it is.
After both of those modes are executed I would like it to save the array as a text file.
I'm tried a few things with clusters and case structures but I suspect I'm barking up the wrong tree. Is there a function or two that are native to lab view that will make this super easy for me?
Thanks in advance for all your help..
C.
Solved! Go to Solution.
05-21-2013 01:07 AM
Create a state machine.
Create a shift register and put your array into it => this will keep your array in memory
On event go to state "DATA ENTER" => add a string to the top op your array with build array => after this go back to state "IDLE"
On event go to state "DATA SORT" => go through your initial array
Make sure you create a second array which is a copy of your first to do the moving of elements. With index array you can read you current element, delete from array removes your current element en build array can put your current element at the back of your array.
After you looped through your initial array => go to state "SAVE" and save your file