This is the tenth article of “The OpenG VIs that I couldn’t live without“, a series of articles showing some of my favorite OpenG VIs. In this article, I’m going to show a very useful VIs called the Conditional Auto-Indexing Tunnel, which is a powerful tool for conditional filtering of 1D arrays.

This VI filters a 1D array, keeping only those elements were corresponding elements in a Boolean array are TRUE. This is a little bit harder to explain with words, than with code, so let’s look at an example of this VI in action. In the simple example, shown below, we are keeping only even elements of the input array. As you can see, the benefit of using Conditional Auto-Indexing Tunnel is that you do not have to do any building or deleting of arrays!

Note: The example, above, may be found in your LabVIEW examples folder, here:
\examples\OpenG\array\Conditional Auto-Indexing Tunnel Example 01.vi
And, here’s an example showing how to filter out elements in an array, without even using a For Loop!

If you want to give this VI a try, you can obtain it using VI Package Manager (VIPM). Simply select the OpenG Array Library (the oglib_array package from within VIPM), you will find the OpenG Array Tools palette in the Functions palette under the OpenG submenu. (See here for a quick guide on how to install OpenG on VIPM.)