1、
’
>> A=[1 2 3;4 5 6;7 8 9]
A =
1 2 3
4 5 6
7 8 9
>> A(4,5)=14
A =
1 2 3 0 0
4 5 6 0 0
7 8 9 0 0
0 0 0 0 14
2、
>> A=[1,3,9,27,81,243]
A =
1 3 9 27 81 243
>> B=diag(A)
B =
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 mydata B
3、
>> clear
load mydata
diag(B)
ans =
1
3
9
27
81
243
’