data_structure
是(长度(num_sounds)行x 3列单元格的单元格
问题在于此
for i=1:num_sounds;
我意识到问题是我同时在同一个文件夹中调用所有'.wav'文件而不是一次调用每个文件
我试过cd(char(sound_dirs{i})); %open a directory
wav_list=dir('*.wav'); %get all the .wav files in the folder
data_structure{i,2}=wav_list; % fills second column with struct the length of the .wav files.
data_structure{i,1}=words{i};
end
但那没用。
for i=1:num_sounds;
num_wavs=length(data_structure{i,2});
for i=1:num_wavs;
[y Fs]= audioread((data_structure{i,2}.name)); %%problem here
data_structure{1,2}.name(40); % the first folder has 47 .wav files