Q:

Read multiple files (wavread)

I want to read several files from certain directory. Here is my script:
prefix = '\wav\';
wav_arr = ['1.wav'; '2.wav'; '3.wav'];
wav_arr = cellstr(wav_arr);

len = length(wav_arr);
sig = [];
fs = [];
for i = 1:len
    path = strcat(pwd, prefix, wav_arr(i));
    [s, curr_fs] = audioread(path);
    sig = [sig s];
    fs = [fs curr_fs];
end

But I receive the error:
Error using which
Argument must contain a string.

Error in audiovideo.internal.absolutePathForReading (line 7)
whichFileName = which(filename);

Error in audioread (line 74)
filename = audiovideo.internal.absolutePathForReading(...

Error in main_experiment (line 14)
    [s, curr_fs] = audioread(path);

The problem is that path is the 1x1 cell, it's not a string. And executing cellstr() for path does not work.

A:

for i = 1:len
    path = strcat(pwd, prefix, wav_arr(i));
    [s, curr_fs] = audioread(path);
    sig = [sig s];
    fs = [fs curr_fs];
end

become 
for i = 1:len
    path = strcat(pwd, prefix, wav_arr{i});
    [s, curr_fs] = audioread(path);
    sig = [sig s];
    fs = [fs curr_fs];
end

That's all, read the doc about the cells in matlab to understand the difference between cell(1) and cell{1}

