i have the following array
1 回表示 (過去 30 日間)
古いコメントを表示
Z=[22,45,65,35,65,54,45,67,84,95,86,58,29,95,93]; How to choose 5 random numbers from these numbers?? So that the output is within these numbers??
0 件のコメント
採用された回答
Star Strider
2017 年 7 月 12 日
One approach:
Z=[22,45,65,35,65,54,45,67,84,95,86,58,29,95,93];
Out = Z(randperm(numel(Z),5))
The randperm function will create random indices for 5 elements of ‘Z’ without repetition.
2 件のコメント
その他の回答 (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!