Graphics Programs Reference
In-Depth Information
a(:,:,3) =
3 3 3
3 3 3
3 3 3
Indexing for multidimensional arrays works in the same way as two-
dimensional arrays;
>> a(2,:,1)
ans =
4
5
6
>> a(2,:,2)
ans =
8
10
12
>> a(2,:,:)
ans(:,:,1) =
4
5
6
ans(:,:,2) =
8
10
12
ans(:,:,3) =
3 3 3
Data can be removed from multidimensional arrays by using the empty
matrix:
>> a(:,:,2) = []
a(:,:,1) =
1
2
3
4
5
6
7
8
9
a(:,:,2) =
3 3 3
3 3 3
3 3 3
Elements can be columnarly extracted from multidimensional arrays in
the same way as they are from two-dimensional arrays:
>> a(:)'
ans =
Columns 1 through 12
147258369333
Columns 13through 18
333333
29.1 Generating Multidimensional Grids
The function meshgrid can be used to create matrices representing
evenly-spaced grids of points.
Search WWH ::




Custom Search