How to resample n vectors with specified length from a longer vector
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Levente Gellért
il 24 Feb 2021
Risposto: Levente Gellért
il 24 Feb 2021
Hi All,
I would like to randomly select n sections (let's say 1000 times) of given length from a longer vector. With the in-built re-sampling functions I can not specify the length of the sections. Sections can overlap.
I do not have initiative at all.
Many thanks!
lg
0 Commenti
Risposta accettata
Walter Roberson
il 24 Feb 2021
starts = randperm(length_of_vector-length_of_section+1, n).';
subsets = cell2mat(arrayfun(@(S) vector(S:S+length_of_section-1), starts, 'uniform', 0));
Each row of subsets will be a different sample.
0 Commenti
Più risposte (1)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!