MATLAB: I have lots of wave file. How to read each one of them using sprintf command

sprinrf

The wave file are like.The first digit- speaker id, second digit-utterence id
  • 00
  • 01
  • 02
  • 03
  • 04
  • .
  • .
  • .
  • 59
I tried using
for m=0:5
for y=0:9
file=sprintf('%s%d%d','E:\0 (1)\0\',m,y);
[s,fs]=wavread(file);
end
end
But this gives error. Alternatively I tried
mypath = 'E:\\0 (1)\\0\\';
filename = sprintf([mypath '%s%d.wav'],m,y);
[s,fs] = audioread(filename);
But it gave error as : Function is not defined for sparse inputs.
Please help me.

Best Answer

mypath = fullfile('E:', '0 (1)', '0');
for m = 0 : 5
for y = 0 : 9
filename = fullfile(mypath, sprintf('%d%d.wav', m, y));
[s, fs] = audioread(filename);
...
end
end
Or in your situation you could use a single loop:
mypath = fullfile('E:', '0 (1)', '0');
for idx = 0 : 59
filename = fullfile(mypath, sprintf('%02d.wav', idx));
[s, fs] = audioread(filename);
...
end