ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Create new 2d array by pulling columns from larger 2d array, as indivated by boolean array

Solved!
Go to solution

Hello,

 

I have a 2d array whose 16 columns contain data from different input chanels.  I also have a 1d boolean array (length 16) corresponding to those columns.  In the 1d boolean array, if a value is true, I want that column in the 2d array to remain.  If the value in the 1d boolean array is false, I want to delete the corresponding column. 

 

Thus, for example, if the 1d boolean array looks like this:

[T T T T F F T T T F T T F F T F]

than the new 2d array would have 10 columns, corresponding to the old 16-column array's columns 1, 2, 3,4, 7, 8, 9, 11, 12, and 15. 

 

I am very new to labview (just started programming yesterday). Can someone help a newbie do something which is probably simple? I think it will involve iterating backwards across the columns of the 16-column array and deleting rows as they come if the boolean vector's value is false, or iterating forwards through the 16-column array and adding columns to a new array if the boolean vector's value is true... but I don't know how to do this.

 

thanks,


Matt

0 Kudos
Message 1 of 4
(2,873 Views)
Solution
Accepted by topic author souperman1985

If you have 2012 you could just do this:

 

Select.png

 

--Ryan S.

0 Kudos
Message 2 of 4
(2,845 Views)

Thanks Ryan.  How do I do the []/? thing on the right side of the for-loop?

 

Matt 

0 Kudos
Message 3 of 4
(2,834 Views)

I figured that out - I right-clicked on the brackets [] and selected a conditional type tunnel.

thanks!

Matt 

0 Kudos
Message 4 of 4
(2,829 Views)