Graphics Programs Reference
In-Depth Information
>>a=[123;456;789]
a=
1
2
3
4
5
6
7
8
9
>> a(:,:,2) = a*2
a(:,:,1) =
1
2
3
4
5
6
7
8
9
a(:,:,2) =
2 4 6
8 10 12
14 16 18
>> a(:,:,3) = eye(3)
a(:,:,1) =
1
2
3
4
5
6
7
8
9
a(:,:,2) =
2
4
6
8
10
12
14
16
18
a(:,:,3) =
1
0
0
0
1
0
0
0
1
Multidimensional arrays must be full N -rectangles; that is, they must
have the same number of elements in parallel dimensions: all rows must
have the same number of columns, all “pages” must have the same num-
ber of rows and columns, etc.
If you assign a single value to a matrix, matlab expands the defini-
tion as you would expect:
>> a(:,:,3) = 3
a(:,:,1) =
1
2
3
4
5
6
7
8
9
a(:,:,2) =
2
4
6
8
10
12
14
16
18
Search WWH ::




Custom Search