randomly picking some files
Afficher commentaires plus anciens
I want to pick some .wav files randomly from a certain directory without replacement or with no repititions .. how is that possible ? please help me in this regard
Réponse acceptée
Plus de réponses (2)
Azzi Abdelmalek
le 10 Sep 2013
your_folder='E:\matlab';
d=dir([your_folder '\*.wav']);
f={d.name};
n=numel(f);
idx=randi(numel(f));
file=f{idx}
f(idx)=[];
2 commentaires
jalal Ahmad
le 11 Sep 2013
sabrina lenglet
le 14 Juin 2017
How can I play this sound or file.wav ? thanks
Walter Roberson
le 10 Sep 2013
Yes. If your file names are in the cell array FileNames then
shuffleidx = randperm(length(fileNames));
for K = 1 : length(suffleidx)
thisfile = fileNames{shuffleidx(K)}
...
end
Catégories
En savoir plus sur Digital Input and Output dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!