Search 1D Array function

From LabVIEW Wiki
Jump to: navigation, search
Search 1D Array function
Object information
Owning palette(s) Array palette
Type Function
Requires Basic Development Environment
Icon Search 1D Array.png

The Search 1D Array function returns the index of the first occurrence of an element in a one-dimensional array or -1 if no match is found. Search starts at the specified start index or at index zero if no start index is specified.

Usage

Connect a one-dimensional array to the 1D array terminal and the element to find at element. The function returns the index of the first matching element.

Search 1D Array - Find First Element.png

To find an element after the first match, set start index to a value higher than the previous match.

Search 1D Array - Find First Element - Start At Index.png

If no match is found the return value is -1

Search 1D Array - No Match Found.png

Best practice

  • Use Reverse 1D Array to search elements from end to start.
  • Be careful when using this function on non-integer values[1][2].

History

Version Change(s)
LabVIEW 2018 More info to come.

See Also

References