Graphics Programs Reference
In-Depth Information
ans =
1
5
9
>>A(2:3,2:3) %The2x2submatrixinlowerrightcorner
ans =
5
7
9
2
Array elements can also be accessedwith a single index. Thus A(i) extracts the
i th elementof A ,counting the elements down the columns.For example, A(7) and
A(1,3) would extract the same elementfroma3
×
3matrix.
Cells
A cell array is a sequence of arbitrary objects.Cell arrayscan becreatedbyenclosing
their contents betweenbraces
{}
.For example, a cell array c consisting of three cells
can becreatedby
>>c=
{
[123],'onetwothree',6+7i
}
c=
[1x3 double]
'one two three'
[6.0000+ 7.0000i]
As seenabove, the contents of some cells are not printedinorder to savespace.
If all contents aretobe displayed, use the celldisp command:
>> celldisp(c)
c
{
1
}
=
1
2
3
c
=
one two three
c
{
2
}
{
3
}
=
6.0000 + 7.0000i
Braces are also used to extract the contents of the cells:
>> c
{
1
}
% First cell
ans =
1
2
3
Search WWH ::




Custom Search