06-29-2009 03:49 AM
hi,
I am having difficulties with this very simple array (following). I want to store data through a while loop which is why I tried with a very simple example. And it doesn't work. The data is erased every loop, and i must set the dimension of the array (100 for this example) to get something or my array stays at 0... but I won't know it in my VI.
Thanks for the help!
Solved! Go to Solution.
06-29-2009 03:52 AM - edited 06-29-2009 03:56 AM
Use a shift register which will store the data from the previous iteration(s) you then append the new data to the array for each time the while loop executes (Right click on the edge of the while loop and you will find the Add Shift Register option) - Mike
Edit Once to resolve typo!
06-29-2009 03:53 AM
Hi christoph...,
you need a shiftrehister on your loop. Right click the loop and select "add shiftregister".
This is a basic question, i recommend to see the free online courses.
Mike
06-29-2009 04:06 AM
hi,
Thanks for your answers! Sorry i forgot about that...
It is working but only if i set the dimension of the array...any clue about how to make this VI work without setting it ?
06-29-2009 04:09 AM
Hi christoph...,
you can also initialize the shiftregister with an array constant and use the build array function inside the loop.
Mike
06-29-2009 04:22 AM - edited 06-29-2009 04:24 AM
Since you are using Replace array element the element needs to exist prior to rewriting the element.
Here are two examples in on shot:
The upper one uses autoindexing, this has the disadvantage that you don't have the data until the loop is finished.
The lower one uses append array element and feedback notes.
Ton
06-29-2009 04:38 AM
hi,
Thanks for the help! Sorry if it is a basic question...