A =
0 1 1 1 0
0 1 1 0 1
0 0 1 0 0
1 0 1 0 0
1 1 1 1 1
>> [m,n]=size(A);
a0=[];
for i=1:m-1
L=[a0,A(i,i+1)];
a0=L;
end
L
L =
1 1 0 0
A =
0 1 1 1 0
0 1 1 0 1
0 0 1 0 0
1 0 1 0 0
1 1 1 1 1
>> [m,n]=size(A);
a0=[];
for i=1:m-1
L=[a0,A(i,i+1)];
a0=L;
end
L
L =
1 1 0 0