フィルターのクリア

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?

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2016 年 4 月 19 日
編集済み: Azzi Abdelmalek 2016 年 4 月 19 日
A=randi(50,1,23)
out = A(randperm(23,20))
  3 件のコメント
Azzi Abdelmalek
Azzi Abdelmalek 2016 年 4 月 19 日
編集済み: Azzi Abdelmalek 2016 年 4 月 19 日
out = A(sort(randperm(23,20)))

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by