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];
0 个评论
采纳的回答
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),:)
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Migrate GUIDE Apps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!