28.12.2012 Views

Figure Properties - SERC

Figure Properties - SERC

Figure Properties - SERC

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

2find<br />

Purpose Find indices and values of nonzero elements<br />

Syntax indices = find(X)<br />

[i,j] = find(X)<br />

[i,j,v] = find(X)<br />

[...] = find(X, k)<br />

find(X, k, 'first')<br />

[...] = find(X, k, 'last')<br />

Description indices = find(X) returns the linear indices corresponding to the nonzero<br />

entries of the array X. If none are found, find returns an empty matrix. In<br />

general, find(X) regards X as X(:), which is the long column vector formed by<br />

concatenating the columns of X.<br />

[i,j] = find(X) returns the row and column indices of the nonzero entries in<br />

the matrix X. This syntax is especially useful when working with sparse<br />

matrices. If X is an N-dimensional array with N > 2, j contains linear indices<br />

for the dimensions of X other than the first.<br />

[i,j,v] = find(X) returns a column vector v of the nonzero entries in X, as<br />

well as row and column indices.<br />

[...] = find(X, k) or [...] = find(X, k, 'first') returns at most the<br />

first k indices corresponding to the nonzero entries of X. k must be a positive<br />

integer, but it can be of any numeric data type.<br />

[...] = find(X, k, 'last') returns at most the last k indices corresponding<br />

to the nonzero entries of X.<br />

Examples X = [1 0 4 -3 0 0 0 8 6];<br />

indices = find(X)<br />

returns linear indices for the nonzero entries of X.<br />

indices =<br />

1 3 4 8 9<br />

You can use a logical expression to define X. For example,<br />

find(X > 2)<br />

find<br />

2-829

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!