How to get n number of sample sets each containing m number of elements from a dataset
2 次查看(过去 30 天)
显示 更早的评论
Hello everyone.
I have a dataset with 1000 numbers (it is a 1:1000 matrix), I want to get n sample sets of this dataset, each containing m numbers without repetition (m is same for each sample set).
How can I do that?
Thanks in advance.
采纳的回答
JESUS DAVID ARIZA ROYETH
2019-11-14
solution:
v1=[1:1000];%put your dataset here
n=16;
m=4;
[~, ind] = sort(rand(n,length(v1)),2);
samples=v1(ind(:,1:m))
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!