The only difference between the
c
c
e
e
l
l
l
l
command and the cell and content
indexing is that by using
c
c
e
e
l
l
l
l
you pre-allocating the cell’s dimensions.
You can use content indexing on the right side of an assignment to access
some or all of the data in a single cell. Specify the variable to receive the cell
contents on the left side of the assignment. Enclose the cell index expression
on the right side of the assignment in curly braces. This indicates that you
are assigning cell contents, not the cells themselves. For example, to store to
B
B the 3-by-3 matrix that is located in
A
A(1,1), you should do the following:
“B=
c
c
e
e
l
l
l
l{1,1};”
to get:
“B =
1 4 3
0 5 8
7 2 9”
and to save in
C
C
the 2
nd
and 3
rd
elements of the vector that is saved in the
(1,1) cell of
G
G
which is saved in the (3,1) cell of
A
A
you do the following:
“C= A{3,1}{1,1}(2:3)”
to get:
“C =
6 9”
If you like to save in
D
D
the cells (1,2) to (2,3) of
A
A
(that is to create a 2-by-2
cell array) you do the following:
“D=A(1:2,2:3)”
to get:
“D =
'Anne Smith' []
Komentáře k této Příručce