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?

1 次查看(过去 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 个评论

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by