data_structure is a cell of (length(num_sounds) row x 3 column cell
- each row corresponds to a different sound
- first column = directory name
- second column = files struct for .wav files
third column = formant data
for i=1:num_sounds;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
problem lies here
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
I realize the issue is that I'm calling all the '.wav' files in the same folder at the same time and not taking each one at a time
I tried data_structure{1,2}.name(40); % the first folder has 47 .wav files
but that didn't work.
name <-- holds all the the names of the .wav files.


data_structure{1,2}(40).namefor i=1:num_sounds; i_num_wavs=length(data_structure{i,2}); for j=1:i_num_wavs; [y Fs]= audioread(data_structure{i,2}(j).name); end endI used @CrisLuengo's suggestion, and it worked in the command window but it still won't run in the script.Error using audioread (line 90) The filename specified was not found in the MATLAB path.Error in celldir (line 37) [y Fs]= audioread(data_structure{i,2}(j).name);cd. You end up in the last directory, so all the files you read are from there. Usefullfile(directory_name,file_name)both when listing the directory contents (wherefile_nameis*.wav) and when reading the file.wav_list=dir(fullfile(char(sound_dirs{i}),'*.wav'));andaudioread(fullfile(char(sound_dirs{i}),data_structure{i,2}.name)).