How do I create a set of random numbers with a given set of numbers? Using randi command.
2 ビュー (過去 30 日間)
古いコメントを表示
Thanakorn Runglerdkriangkrai
2020 年 9 月 22 日
コメント済み: Thanakorn Runglerdkriangkrai
2020 年 9 月 22 日
This is my code,
a = [8 5 2 6 9 3 1 4 0 7];
randi(imax,n);
When I run it, there is an error, "Unrecognized function or variable 'imax' ". So I am wondering what is my mistake here?
0 件のコメント
採用された回答
madhan ravi
2020 年 9 月 22 日
編集済み: madhan ravi
2020 年 9 月 22 日
a(randi(numel(a), 1, numel(a))) % for unique numbers use randperm()
その他の回答 (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!