フィルターのクリア

dear all:I have a 6* 3 matrix. I wanna choose 4rows randomly. how can I selecete all array in a rows randomly without replacement?

2 ビュー (過去 30 日間)
for example:
A=[1 2 3;2 3 5;6 4 1;8 6 0;2 4 1;1 4 7;8 4 2];
and the answer is:
[1 2 3;6 4 1;8 6 0;8 4 2];

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2016 年 7 月 27 日
編集済み: Azzi Abdelmalek 2016 年 7 月 27 日
A=[1 2 3;2 3 5;6 4 1;8 6 0;2 4 1;1 4 7;8 4 2]
B=A(randperm(6,4),:)
  4 件のコメント
Azzi Abdelmalek
Azzi Abdelmalek 2016 年 7 月 27 日
編集済み: Azzi Abdelmalek 2016 年 7 月 27 日
idx=sort(randperm(6,4))
B=A(idx,:)
fariba amini
fariba amini 2016 年 7 月 27 日
thanks a lot. it works.thanks again

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by