LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

There should be a way to index an array with an array of indexes or booleans (without a loop)

Hi, often I would love to index an array with an array of indexes or an array of booleans without having to loop it.  I.e: let the IndexArray function accept an array of indexes instead of discrete indexes.  The output should then be an array of indexes values.  

 

Another use case is to index with an array of booleans, so each TRUE element would index the input array and FALSE elements are not indexed.

 

arrResult = arrInput[ arrIndexes ];  or

arrResult = arrInput[ arrVal > 20 ];

 

Would this be useful? Possibly it could be implemented in future versions?

 

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

Post this to the idea exchange. Sounds like a feature I could have used as well.

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

You can find a set of VIs that does this in OpenG.  It still loops through the array, but at least you are not constantly writing for loops to do it.

0 Kudos
Message 3 of 6
(2,170 Views)

OK I've posted this to the idea exchange.  Let's keep our fingers crossed...

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

You forgot the link.

Message 5 of 6
(2,155 Views)

Thanks.

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