How to generate non repeating random numbers
3 ビュー (過去 30 日間)
古いコメントを表示
Hi, I have a matrix of size 270x360 ,what i need to do is generate any random location in that matrix such that all the locations of that matrix are generated at least for once.Is that possible.If so can anybody please help me with it? Thank you, Deepa
0 件のコメント
採用された回答
Azzi Abdelmalek
2015 年 8 月 9 日
編集済み: Azzi Abdelmalek
2015 年 8 月 9 日
A=zeros(270,360)
The locations of the matrix A are 1:270*360 (using linear indexing)
n=270*360
random_location=randperm(n)
If you want subscript indices ii and jj use ind2sub function
[ii,jj]=ind2sub(size(A),random_location)
3 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!