LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to manipulate arrays using case statements and boolean conditions?

In the vi that is attached I am trying to compare two values in two different arrays and delete the value that is equal to zero.  The values of each array are rounded to the closest integer.  Then I attempted to apply the ">0" boolean as the condition for my case statement, but I am getting an error.  Any tips on manipulating arrays with case statements?
0 Kudos
Message 1 of 5
(2,756 Views)

Hi twinkle,

 

you can't connect an array to the case selector. So you need a loop to run through your array... See attachment - but keep in mind it's not clear what you want to achieve with those case structures!

Best regards,
GerdW


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

Thank you!!! that was a huge help. I don't think I need the case structures at allSmiley Happy.  The next part of the code compares the 4 values in the array. 

 

If columns 0 and 1 are both positive -> output 1

If column 0 is negative and 1 is positive -> output 2

If columns 0 and 1 are both negative -> output 3

If column 0 is positive and 1 is negative -> output 4

 

(0 is x-axis value, 1 is y-axis value.....outputs are assigning quadrants to the combination)

 

 

Only one of the "AND" booleans will return true for each index.  Is there a way to initialize another array of outputs 1-4 depending on which AND returns true?

 

 

0 Kudos
Message 3 of 5
(2,738 Views)
oops.  it compares the TWO** values in the array...
0 Kudos
Message 4 of 5
(2,737 Views)

Hi twinkle,

 

see example... You could also use several case structures or put your selection functions in a line using output of the earlier as input for false case...

Message Edited by GerdW on 04-08-2009 11:36 PM
Best regards,
GerdW


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