필터 지우기
필터 지우기

how to create a square matrix with unique real values?

조회 수: 1 (최근 30일)
Jyothi Alugolu
Jyothi Alugolu 2018년 2월 21일
편집: Jos (10584) 2018년 2월 21일
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