28.12.2012 Views

Figure Properties - SERC

Figure Properties - SERC

Figure Properties - SERC

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

ind2sub<br />

2ind2sub<br />

Purpose Subscripts from linear index<br />

Syntax [I,J] = ind2sub(siz,IND)<br />

[I1,I2,I3,...,In] = ind2sub(siz,IND)<br />

Description The ind2sub command determines the equivalent subscript values<br />

corresponding to a single index into an array.<br />

2-1168<br />

[I,J] = ind2sub(siz,IND) returns the matrices I and J containing the<br />

equivalent row and column subscripts corresponding to each linear index in the<br />

matrix IND for a matrix of size siz. siz is a 2-element vector, where siz(1) is<br />

the number of rows and siz(2) is the number of columns.<br />

Note For matrices, [I,J] = ind2sub(size(A),find(A>5)) returns the same<br />

values as [I,J] = find(A>5).<br />

[I1,I2,I3,...,In] = ind2sub(siz,IND) returns n subscript arrays<br />

I1,I2,..,In containing the equivalent multidimensional array subscripts<br />

equivalent to IND for an array of size siz. siz is an n-element vector that<br />

specifies the size of each array dimension.<br />

Examples Example 1. The mapping from linear indexes to subscript equivalents for a<br />

3-by-3 matrix is<br />

1 4<br />

2 5<br />

3<br />

6<br />

7<br />

8<br />

9 3,1<br />

1,1 1,2<br />

2,1 2,2<br />

This code determines the row and column subscripts in a 3-by-3 matrix, of<br />

elements with linear indices 3, 4, 5, 6.<br />

3,2<br />

1,3<br />

2,3<br />

3,3

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

Saved successfully!

Ooh no, something went wrong!