LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Boolean Array Initialization

Solved!
Go to solution

I am a hobbyist, and need some help.

Two seemingly identical programs, I want the "Incorrect Initialization.vi" To initialize the boolean array to a completely false state as in "Correct Initialization.vi"

I already tried /Data Operations/Make current Value Default path after setting all elements in the array to "False". But still when I run the program only initializes one element.

Attached is the desired initialization and the failed attempt. I just want to know why the second program does not want to run and initialize the array values.

 

Also the other parts of the program are going to be used for other purposes. For that reason I did not delete it but if the problem is one of the structures I would like to know which one is conflicting. Remember that both programs apparently use the same functions , so they should not be the

Thanks in advance

Download All
0 Kudos
Message 1 of 5
(5,555 Views)
Solution
Accepted by topic author boli98

The easiest way is to use Initialize Array function.

 

If you want to do it with the constant, expand the constant to see more  of it.  Click whichever element you want to be the lower right corner to set it, and click it again to set to false.  Right now you just have a 1 element array.

Message 2 of 5
(5,551 Views)

Hi boli,

 

two notes:

- initialize the array to 8×8 booleans instead of just 1×1…

- move the array control to the origin of the front panel (or pane) to avoid an offset in the (mouse) coordinates

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 3 of 5
(5,549 Views)

Oh god,that was easy haha; Thanks a lot!

0 Kudos
Message 4 of 5
(5,542 Views)

In addition...:

 

  • the all false diagram constant belongs before the loop, because it needs to be read only once. (This eliminates the sequence structure.)
  • The array belongs into a shift register, (eliminating the local variables).
  • The array should probably be an indicator because the values are updated programmatically (mouse events work fine on an indicator, see e.g. here)
  • There should be an event for the stop button (eliminating the timeout event).
  • There is no need for the outer loop. It just restarts the code. If this is desired, create a state machine with a single outer loop instead.
  • Don't label a "Go" button with "stop". Makes the diagram confusing to read.
0 Kudos
Message 5 of 5
(5,519 Views)