Hi all, I'm trying to create a square matrix 9×9 where all the values are 9 and the diagonal is 0. Example:
0 9 9 9 0 9 9 9 0
I found a way to do it which is:
s(logical(eye(size(s)))) = 0
Is there an easy way to substitute a diagonal of a matrix (possibly without using [m n] = size(s) –> s[1:m]….) Thanks
Best Answer