randomly picking some files
Ältere Kommentare anzeigen
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
Akzeptierte Antwort
Weitere Antworten (2)
Azzi Abdelmalek
am 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 Kommentare
jalal Ahmad
am 11 Sep. 2013
sabrina lenglet
am 14 Jun. 2017
How can I play this sound or file.wav ? thanks
Walter Roberson
am 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
Kategorien
Mehr zu Audio I/O and Waveform Generation finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!