i have a vector which contain 23 elements.i wanna choose 20 elements among this 23 elements randomly.how can i do this?
1 回表示 (過去 30 日間)
古いコメントを表示
i have a vector which contain 23 elements.i wanna choose 20 elements among this 23 elements randomly.how can i do this?
0 件のコメント
採用された回答
Azzi Abdelmalek
2016 年 4 月 19 日
編集済み: Azzi Abdelmalek
2016 年 4 月 19 日
A=randi(50,1,23)
out = A(randperm(23,20))
3 件のコメント
Azzi Abdelmalek
2016 年 4 月 19 日
編集済み: Azzi Abdelmalek
2016 年 4 月 19 日
out = A(sort(randperm(23,20)))
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Resizing and Reshaping Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!