can anybody help me with this code error ?

I have this code for voice recognition and when I run it I get error :
--------------
Error using wavread (line 66)
Invalid Wave File. Reason: Cannot open file.
Error in Untitled2 (line 16)
[t, fs] = wavread (file);
------------------------
This is the code I have : attached

1 Comment

The error seems fairly self-explanatory and suggests the code is fine, but your wav file is in the wrong format or corrupted or, for some other reason cannot be read by wavread.
wavread no longer exists in R2015b apparently so I assume you are using an earlier version of Matlab.

Sign in to comment.

Answers (1)

Your code
file = sprintf ('%s%d.wav','rec',j);
path='rec1.wav';
file=cat(2,path,file);
is going to create the file name 'rec1.wavrec1.wav' which does not exist.
You wrote the file without using any path, so do not use a path when creating the name to read it from.

Asked:

on 25 Nov 2015

Answered:

on 25 Nov 2015

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!