how to create a square matrix with unique real values?

Hello, I want a random square matrix of size 10*10, where each row must contain random values from 1 to 10...

 Accepted Answer

n=10;
for i=1:n
A(i,:)=randsample(n,n).';
end

More Answers (1)

A very simple one-liner will do the trick:
N = 10 ;
[~, A] = sort(rand(N), 2)

Categories

Asked:

on 21 Feb 2018

Edited:

on 21 Feb 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!