I tried to build a (9,9) matrix that will look like that:
% code
first row: 000000009second row: 000000088third row : 000000777forth row : 000006666fifth row : 0000555556th row : 0004444447th row : 0033333338th row : 0222222229th row : 111111111
my code is:
% code mymat=zeros(9,9);for ii=1:(size(mymat,1)) for jj=1:(size(mymat,2)) mymat(ii,[9(10-jj)])= 10-ii; endend
the result is this:
% code 0 0 0 0 0 0 0 0 9 0 0 0 0 0 0 0 0 8 0 0 0 0 0 0 0 0 7 0 0 0 0 0 0 0 0 6 0 0 0 0 0 0 0 0 5 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 1
what am I doing wrong?
Best Answer