how to create a square matrix with unique real values?

1 次查看(过去 30 天)
Hello, I want a random square matrix of size 10*10, where each row must contain random values from 1 to 10...

采纳的回答

Birdman
Birdman 2018-2-21
编辑:Birdman 2018-2-21
n=10;
for i=1:n
A(i,:)=randsample(n,n).';
end

更多回答(1 个)

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

类别

Help CenterFile Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by