A(I)
is an array formed from the elements ofA
specified by the subscript vectorI
. The resulting array is the same size asI
except for the special case whereA
andI
are both vectors. In this case,A(I)
has the same number of elements asI
but has the orientation ofA
.
A(I,J)
是一个数组的元素形成rectan吗gular submatrix ofA
, specified by the subscript vectorsI
andJ
. The resulting array haslength(I)
rows andlength(J)
columns. A colon used as a subscript indicates all elements in that dimension. For example,A(I,:)
means all columns of those rows specified by vectorI
. Similarly,A(:,J)
means all rows of columns specified byJ
.
A(I,J,K,...)
is the array specified by the subscripts. The result islength(I)
-by-length(J)
-by-length(K)...
.
A{I}
whereA
is a cell array andI
is a scalar forms a copy of the array in the specified cell ofA
. IfI
has more than one element, this expression is a comma-separated list. You can also use multiple subscripts that specify a scalar element, as inA{3,4}
.
A(I).field
whenA
is a structure array andI
is a scalar forms a copy of the array in the field with the namefield
. IfI
has more than one element, this expression is a comma-separated list. IfA
is a 1-by-1 structure array, then the subscript can be dropped. In this case,A.field
is the same asA(1).field
.