>> A=[1 2 3;2 3 4;3 4 5]
A =
1 2 3
2 3 4
3 4 5
>> A
A =
1 2 3 4 5
2 3 4 5 6
3 4 5 6 7
4 5 6 7 8
>> b=ones(6,1)
b(2:end)=3
B=cumprod(b)
b =
1
1
1
1
1
1
b =
1
3
3
3
3
3
B =
1
3
9
27
81
243
>> C=diag([1 3 9 27 81 243])
C =
1 0 0 0 0 0
0 3 0 0 0 0
0 0 9 0 0 0
0 0 0 27 0 0
0 0 0 0 81 0
0 0 0 0 0 243
>> save matfile1 C
>> load matfile1 C
>> C
C =
1 0 0 0 0 0
0 3 0 0 0 0
0 0 9 0 0 0
0 0 0 27 0 0
0 0 0 0 81 0
0 0 0 0 0 243
>> c=C(:,1)
c =
1
0
0
0
0
0
A =
1 2 3
2 3 4
3 4 5
>> A
A =
1 2 3 4 5
2 3 4 5 6
3 4 5 6 7
4 5 6 7 8
>> b=ones(6,1)
b(2:end)=3
B=cumprod(b)
b =
1
1
1
1
1
1
b =
1
3
3
3
3
3
B =
1
3
9
27
81
243
>> C=diag([1 3 9 27 81 243])
C =
1 0 0 0 0 0
0 3 0 0 0 0
0 0 9 0 0 0
0 0 0 27 0 0
0 0 0 0 81 0
0 0 0 0 0 243
>> save matfile1 C
>> load matfile1 C
>> C
C =
1 0 0 0 0 0
0 3 0 0 0 0
0 0 9 0 0 0
0 0 0 27 0 0
0 0 0 0 81 0
0 0 0 0 0 243
>> c=C(:,1)
c =
1
0
0
0
0
0