05-08-2010 12:33 PM
Helo,
I have a question about arrays. I want to place every 2 hours a value in an array. After 24 hours (1 day), the array must be cleared for placing new values in the array. The values must
be placed on index 0 till 11. When i clear the array, the differnt values in the array are changed to 0 ( I use Initialize Array ), but instead of starting from index 0 it starts from index 12.
This repeats itself every time i start a new day. As a result the array size will keep growing instead of staying between 0 and 11
Grtz
05-08-2010 12:45 PM
Hi Jurgen,
if you would use InitializeArray then you should get an empty array of 12 elements.
But from your description I would suspect there is a BuildArray somewhere in your code...
So to solve this mystery it would be best to actually see your VI!
05-08-2010 01:09 PM - edited 05-08-2010 01:13 PM
Hi GerdW,
This is the problem area. I hope you could see enough.
05-08-2010 02:09 PM
05-09-2010 03:44 AM
Hi GerdW,
You are right. I'm a new user of LV. The InitArray is placed in a true case of a case structure
Grtz
Jurgen
05-09-2010 03:56 AM - edited 05-09-2010 03:58 AM
Hi JurgenV,
the problem is located in the general overuse of locals...
Well, you clear the array by writing to it's local. BUT: there is a feedback node, which keeps the last value for the next iteration! And this feedback node isn't cleared too! So think about dataflow and redesign your VI
Hint: join frame 1 and 3 of your flat sequence (counting starts with 0) into one frame to get rid of that local. Feed the feedback node with the same value as the array indicator...
05-09-2010 05:16 AM
Hi GerdW,
About clearing the feedback node. When I use the debugger I noticed the "index" of the feedback node isn't cleared. Is there a possibility
to clear it.
Grtz
Jurgen
05-09-2010 06:25 AM - edited 05-09-2010 06:27 AM
Hi GerdW,
I think I have a solution, may it isn't the best solution but it works. Every time there are 12 values in my array the array will be cleared and the index of my shift register start by 0.
Thanks
Jurgen
05-09-2010 01:40 PM