LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

case structure error

I have a vi that is supposed to add or subtract two array based on whether on the output of a  boolean array.  I have looked at the boolean array I created and it has both true and false values, but the structure I created only adds, indicating that somehow my data got distorted and it only reads false inside the loop.  I would greatly appreciate any tips on what I need to change to get the vi to work properly
0 Kudos
Message 1 of 6
(3,277 Views)

I don't understand what you are trying to do.  Your program works just fine.  It adds when it is supposed to add and subtracts when it is supposed to subtract.  Your loops are only running one time, so the output is only going to be based upon the first element in the array.  If you could explain a little better what your result should be I expect that the solution will be simple.

0 Kudos
Message 2 of 6
(3,258 Views)
I think that the case structure condition only looks at the first value in your boolean array. So, if index 0 of your boolean array is true, then the case structure will evaluate to true. On the other hand, if index 0 of your boolean array is false then the case evaluates to false. I hope this helps.

Molana
0 Kudos
Message 3 of 6
(3,256 Views)

I don't think I fully understand what you are trying to do either.  Is this a simplified version of a more complex program?  If not, the For Loops that execute only once and the shift registers are unnecessary, just feed in your data directly.  See attached VI

It sound like you are looking for the Or Array function (on the Boolean palette), this will check if ANY elements of the boolean array are true. 

Please post a little more explanation of what you need if this does not help. 

Beth

0 Kudos
Message 4 of 6
(3,249 Views)
Here you go.  Made some modifications...
0 Kudos
Message 5 of 6
(3,245 Views)


@Danjohn wrote:
I have a vi that is supposed to add or subtract two array based on whether on the output of a  boolean array.  I have looked at the boolean array I created and it has both true and false values, but the structure I created only adds, indicating that somehow my data got distorted and it only reads false inside the loop.  I would greatly appreciate any tips on what I need to change to get the vi to work properly


Get rid of all the shift registers and use plain autoindexing. Be aware that all your arrays should be the same size. If not, the shortest lengh in each dimension will take precendence.

The attached VI contains some default data in the inputs, just run and see. 🙂

0 Kudos
Message 6 of 6
(3,229 Views)