- #1
Jamshaid3
- 2
- 0
Hello participants. Can anyone help me in the code of loading wavs... I am getting some error...
Function for the Code is...
function [wavs,fs] = load_wavs(directory)
% Initialize variables
data = 0;
fs = 0;
% Load the wavs
if(nargin < 1),
D = dir;
else
D = dir(directory);
end
for i=2 : size(D,1),
if(size(findstr(D(i).name,'.wav'),1))
[wav,fs,nbits] = wavread(D(i).name);
wav = wav ( :,1 );
data = add_wav(wav,data);
end
end
wavs = zeros(size(data,2)-1,size(data,1));
for i=2 : size(data,2),
wavs( i-1,: ) = data ( :,i )';
end
After saving it when I call it from command window ...
x = load_wavs('test') %test is a folder containing .wav files in my current directory
It gives me error...
? Error using ==> wavread at 67
Cannot open file.
Error in ==> load_wavs at 26
[wav,fs,nbits] = wavread(D(i).name);
Am I doing something wrong... I have tried to change the path but same result...
Please help me to get rid of this inconvenience... ASAP
Function for the Code is...
function [wavs,fs] = load_wavs(directory)
% Initialize variables
data = 0;
fs = 0;
% Load the wavs
if(nargin < 1),
D = dir;
else
D = dir(directory);
end
for i=2 : size(D,1),
if(size(findstr(D(i).name,'.wav'),1))
[wav,fs,nbits] = wavread(D(i).name);
wav = wav ( :,1 );
data = add_wav(wav,data);
end
end
wavs = zeros(size(data,2)-1,size(data,1));
for i=2 : size(data,2),
wavs( i-1,: ) = data ( :,i )';
end
After saving it when I call it from command window ...
x = load_wavs('test') %test is a folder containing .wav files in my current directory
It gives me error...
? Error using ==> wavread at 67
Cannot open file.
Error in ==> load_wavs at 26
[wav,fs,nbits] = wavread(D(i).name);
Am I doing something wrong... I have tried to change the path but same result...
Please help me to get rid of this inconvenience... ASAP