How to get n number of sample sets each containing m number of elements from a dataset
2 views (last 30 days)
Show older comments
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.
Accepted Answer
JESUS DAVID ARIZA ROYETH
on 14 Nov 2019
solution:
v1=[1:1000];%put your dataset here
n=16;
m=4;
[~, ind] = sort(rand(n,length(v1)),2);
samples=v1(ind(:,1:m))
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!