LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

clear array

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

0 Kudos
Message 1 of 9
(3,588 Views)

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!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 9
(3,584 Views)

Hi GerdW,

 

This is the problem area. I hope you could see enough.

Array.jpg

Message Edited by JurgenV on 05-08-2010 01:13 PM
0 Kudos
Message 3 of 9
(3,574 Views)

Hi JurgenV,

 

I don't see any InitArray node... Only some locals and uninitialized shiftregisters Smiley Wink

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 9
(3,556 Views)

Hi GerdW,

 

You are right. I'm a new user of LV. The InitArray is placed in a true case of a case structure

Array 2.JPG

 

Grtz

Jurgen

0 Kudos
Message 5 of 9
(3,536 Views)

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 Smiley Wink

 

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...

Message Edited by GerdW on 05-09-2010 10:58 AM
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 9
(3,533 Views)

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

0 Kudos
Message 7 of 9
(3,522 Views)

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.

 

Array 3.JPG

 

Thanks

Jurgen

Message Edited by JurgenV on 05-09-2010 06:27 AM
0 Kudos
Message 8 of 9
(3,507 Views)

Hi JurgenV,

 

you nearly took my advice:

When you connect the "2hrs array" indicator with the output of the Select function you can get rid of the last frame of the sequence and so forget about that local...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 9
(3,491 Views)