LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Numeric to boolean array

Solved!
Go to solution

Hello All,

 

I am working on a program in which I can input a nXy array of enumerator which has 3 numeric values of 0,1,2. The values of 0,1,2 correspond to 3 cases of  constant boolean values. Numeric and its corresponding boolean values are given below:

 

Numeric Value : 0, Boolean values :  False, False

Numeric Value : 1: Boolean Values: True, False

Numeric Value : 2: Boolean Values : True, True.

 

Thus my nXy array of numeric values hwould get transformed to nX 2y array of boolean values with 2 boolean values corresponding to each numeric element of the array. The image shows the tranformation which I am trying to do.

 

To make this work, I took the numeric array and added 2 for loops ( one for row and one for column ) and checked each element of the array for the 3 cases. 0,1,2. In each case I have the boolean contants corresponding to the case. Since the nth element in the  numeric array will lead to correspoding boolean values in (2*n),(2*n)+1 elements  of the array I have a corresponding program for that too.

 

However when I output the results, it doesnt seem to come out properly and I am not sure where the logic is going wrong. If anyone can help me with this, it will be great.

 

 

Download All
0 Kudos
Message 1 of 6
(2,754 Views)

Try this....

 

(note that the inner tunnel is concatenating)

 

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

And here are a few comments about your code:

 

  • Why would you need to read from a value property node in the innermost loop? Just wire to the terminal
  • Learn about autoindexing!
  • Your inner code is full of race conditions because there is no way to tell if the booleans get written first or the value property nodes are read first. Completely unpredictable, because of lack of data dependecies.
  • In the inner loop you are always starting over with an empty array, insert something, then reshape it to nothing.

I would recommend you start with a few introductory tutorials... 😄

Message 3 of 6
(2,736 Views)

Hello Altenbach,


This works very well. Thanks a lot. I have a quick question though. The concatenating tunnel mode is present only in LabVIEW 2012 I believe. My main program is actually running in LabVIEW 7.1 which does not have this feature. What would you recommend to do for that?

 

 

0 Kudos
Message 4 of 6
(2,724 Views)
Solution
Accepted by topic author GV8

@GV8 wrote:

What would you recommend to do for that?


An initialized shift register and a built array (set to concatenate) in the inermost loop. Rest stays the same.

 

Message 5 of 6
(2,707 Views)

Thank you very much. This was very helpful.

 

And I will take your advise and revise through some fundamentals of LabVIEW...:)

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