randomly picking some files
显示 更早的评论
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
采纳的回答
更多回答(2 个)
Azzi Abdelmalek
2013-9-10
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 个评论
jalal Ahmad
2013-9-11
sabrina lenglet
2017-6-14
How can I play this sound or file.wav ? thanks
Walter Roberson
2013-9-10
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
类别
在 帮助中心 和 File Exchange 中查找有关 Audio I/O and Waveform Generation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!