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...

 채택된 답변

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)

카테고리

도움말 센터File Exchange에서 Random Number Generation에 대해 자세히 알아보기

질문:

2018년 2월 21일

편집:

2018년 2월 21일

Community Treasure Hunt

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

Start Hunting!

Translated by