MATLAB: How to generate a random symmetrical matrix with a diagonal line of 0s.

How to generate a random symmetrical matrix with a diagonal line of 0s.

Best Answer

Not sure what "random matrix" means. John thinks it means values in some random locations, while I think it means values in every location that have a random value. For my assumption, try this:
maxValue = 1000000; % Whatever...

rows = 7; % Whatever...
m = randi(maxValue, rows, rows); % Initialize
m(logical(eye(rows))) = 0 % Set diagonal to zero.