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 Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by