findnz (MathScript RT Module Function)

LabVIEW 2012 MathScript RT模块帮助

版本日期:June 2012



Owning Class: linalgebra

Requires: MathScript RT Module


ind = findnz(a)

ind = findnz(a, n)

ind = findnz(a, n, direction)

[i, j] = findnz(a)

[i, j] = findnz(a, n)

[i, j] = findnz(a, n, direction)

[i, j, c] = findnz(a)

[i, j, c] = findnz(a, n)

[i, j, c] = findnz(a, n, direction)

Legacy Name: find


Returns the indexes of all non-zero elements in a matrix.



Name Description
a Specifies a vector or matrix of any data type.
n Specifies the number of matches to return. n is a positive integer. The default is to return all matches.
direction Specifies the direction to search for matches. direction is a string.

'first' (default) Returns the first n matches.
'last' Returns the last n matches.


Name Description
ind Returns the linear indexes of all non-zero elements of a. a is considered a long vector a(:) if only one output is required. ind is a row vector if a is a row vector, otherwise ind is a column vector.
i Returns the first indexes of all non-zero elements of a. i is a column vector.
j Returns the second indexes of all non-zero elements of a. j is a column vector.
c Returns all non-zero elements of a. c is a column vector.


The following table lists the support characteristics of this function.

Supported in the LabVIEW Run-Time Engine Yes
Supported on RT targets Yes
Suitable for bounded execution times on RT Yes


A = [1, 2, 3; 0, 0, 0; 0, 2, 3]
[I, J] = findnz(A)

Related Topics