03-02-2015 11:41 PM
Hi
I am getting a 1D array of double inside the while loop. The 1D array consists of just a single element and it overwrites itself everytime in the loop. I need to store it in a separte array of given length before the overwrite.
For example: I am getting 1D array from 1 to 10 but sequentially i.e. 1 then next loop 2 then 3 and so on. 2 overwrites 1, 3 overwrites 2 and so on. What I need to do is save the incoming values before the overwrite from 1 to 10 in a single separate array.
I tried to use Index array and Build array functions but I could not get the desired result. I also tried using shift register but I think I am wrong somewhere. Will you please help me.
Thank you for your help.
Solved! Go to Solution.
03-03-2015 12:36 AM
Did you want something like this? The array is built up and stored in a shift register (so you were on the right track). Where you might have gone wrong is with the Build Array function - you have to right click and choose 'Concatenate Inputs' in order for it to add each new 1D array to the end of the existing one - if you don't then it adds the new array as another dimension to the existing one!
03-03-2015 12:38 AM
There are many functions already implemented in LV, use those, less work to do by yourself 😉
03-03-2015 01:11 AM - edited 03-03-2015 01:14 AM
I just forgot, of course if you want to play with such snippet, put some wait function (Wait (ms)) in it, you do not want to poll your CPU and you wanna see the numbers evolving in the array not too fast.
03-03-2015 06:20 PM
Thank you for your help. Its working now. Thanks for pointing out the concatenation option for the build array function. I was going wrong there. Thanks again
03-03-2015 06:24 PM
Sorry I could not use Data Queue because my input is 1D array but this function accepts only elements from input data point port. Thank you anyways