LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do you make a new array from selected columns of a 2-dimensional array

I have a two dimensional array. I want to make a new array, either 1 dimensional, or two dimensional, made up of selected columns of the original array. This is going into a max/min function.
 
In a conventional programming language, I could just use an if statement to get the columns I want and ignore the other columns. But in Labview, there doesn't seem to be the equivalent of a simple if statement. I tried to use the case statement, but Labview wants the output tunnel to always be connected, which in my case just puts the entire original array into my new array.
 
To be more specific, what I have is a two dimensional array. I need to take columns 4, 6, 9, etc, and put those into a new array. How do I do that.
 
Thanks.
 
Chuck Gantz
0 Kudos
Message 1 of 3
(2,494 Views)
If you go into your functions pallette then click on Array there is an assortment of array functions you can use to manipulate arrays.  There is an Index Array vi that will do what you want.  Look in help to see how to implement this function.
 
Brian

Message Edited by BrianPack on 08-29-2005 04:52 PM

0 Kudos
Message 2 of 3
(2,491 Views)
See attached vi, no case needed.  You need to study the case structure to see how it is used.  It can be used anywhere an If statement is needed.  For the unwired terminal, you can choose default if unwired by right clicking on it, or you can use a shift register to pass the value unchanged.
- tbob

Inventor of the WORM Global
0 Kudos
Message 3 of 3
(2,484 Views)