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
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 个)

类别

Help CenterFile Exchange 中查找有关 Simulink 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by