Example Code

Searching a 2D Array

Code and Documents

Attachment

This VI uses the function "Search 1D Array" to search a 2D array in the same fashion. The inputs are the 2D array to search and the element you want to search for. The VI returns a two-element 1D array of the indices of where the element was found. Index 0 refers to the row and index 1 refers to the column of the element found in the 2D array. Both elements in the output array display -1 if the search element was not found. This VI is polymorphic and accepts numeric, Boolean, and string data.

Because the VI is polymorphic, it is saved in an .llb to distribute all the files. To use the VI, open the .llb and select the top-level VI.

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Contributors