12-02-2014 07:56 PM
hello, i have a basic application in which i need to define an array of size 19; and add 19 elements to it.
Once 19 elements have been written to the array, i want to start writing to the array from index 0.
It's like in C language, where-in you define array_size in init, and once the array is full, you overwrite the 1st element and so on.
i hope my question makes sense...
any help is appreciated.
12-02-2014 08:08 PM
You can define an array of size 19 with Initialize Array. For loops are good ways to index through an array -- learn about them. If you want to simply replace a numbered element, replace Array Subset can work (the subset if an array of 1 element). More experienced LabVIEW users might use the In Place Element Array Index/Replace Element, but you should start with the For Loop. There are good tutorials out there ...
BS
12-02-2014 10:56 PM
Rotate 1D Array might be a useful function for you as well.
12-02-2014 11:11 PM
Hello LV_Enthu,
As Bob said, there is the two way of initialize array, you can follow any of the method which are displayed in image.
12-03-2014 04:14 AM
Hi Check out these VIs as per your discription. You can try your own method.
12-03-2014 04:25 AM - edited 12-03-2014 04:28 AM
Hi PBP,
the OP said to use LV8.0, so your LV2012 VIs aren't accessible…
It's like in C language, where-in you define array_size in init, and once the array is full, you overwrite the 1st element and so on.
Try this:
It defines an array with a certain size and fills it by overwriting the elements. Thanks to QR operation it starts over with 1st element once the array "is full"…
12-03-2014 04:38 AM
Ohh Sorry,
Please Find LV8.0 version.
12-03-2014 04:39 AM
I hope this is in a useable version for you. Basically it covers a solution in which you write values at arbitrary intervals. I used an event structure to make my point, but it could of course be a state in a state machine or a while loop or something...
Like RavensFan suggested, it uses the rotate 1D array to rearrange your array. You take the last element and places it first, then replace it with a new value.