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.
|
| 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. |
A = [1, 2, 3; 0, 0, 0; 0, 2, 3]
[I, J] = findnz(A)