LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Wiring 2D boolean array to case structure

I have a 2D array that I'm testing to see if it is above or below a threshold value to do different manipulation of array elements based on whether they are above or below.  I'm able to generate the 2D boolean array, but when I try to wire it to a case structure it doesn't allow it because it will only accept one single boolean value.  When I split the array into just a single element it still doesn't let me wire it because it's an array instead of a single value.  Is there some formating I need to do to the array to turn it into a simple boolean value?  If you can think of another way to operate based on the boolean values instead of having to do the intenive procedure of splitting each element out and operating on it I would greatly appreciate any advice.

 

0 Kudos
Message 1 of 6
(2,531 Views)

This really depends what you want to do. Do you want:

(A) handle each matching array element differently?

(B) Just know if at least one element is true?

 

For (A),  you would place your case structure inside two autoindexing FOR loops. For each element the appropriate operation takes place. (Of course it would be more efficient to feed the original array across, and do the comparison operation right in front of the case structure for each element. This way you don't need to allocate the entire throwaway boolean array in memory. 🙂

For (B), you would take the logical OR of the boolean array ("OR array elements") and feed it to the case selector.

Message Edited by altenbach on 07-21-2005 09:54 AM

Message 2 of 6
(2,522 Views)

If you place your comparison/case statement inside a FOR loop nested inside another FOR loop, then wire the 2D array to the loops, as shown. If you note the numeric probe you will see which dimension of the array is indexed in which loop (row by row).

 

P.M.

Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



Message 3 of 6
(2,518 Views)

Thank you so much for your comments.  It helped immensely!  I am trying to test each element individually instead of just seeing if one element meets the requirement.  Your comment on having me put the case structure on two for loops helped, but I'm afraid I did my indexing with the array incorrectly because the data left completely garbeled instead of preforming the calculation I wanted.  I'm not sure if I put shift registers where there should have been loop tunnels or indexed to rows where I should have indexed columns, but any feedback you can give me on why the data is getting sorted wrong would be greatlly appreciated.

I'm attaching my VI below.  It supposed to take the test array and for all elements greater than 12 put in the value of the luminance array, but for all values below twelve it needs to substitute 255 for that element.

0 Kudos
Message 4 of 6
(2,503 Views)

Don't complicate things! You don't need any shift registers.

I think what you need is this (LabVIEW 7.1). Modify as needed.

Message Edited by altenbach on 07-21-2005 11:28 AM

Download All
0 Kudos
Message 5 of 6
(2,496 Views)

Is this closer to what you are trying to do?

P.M.

Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 6 of 6
(2,486 Views)