how to remove this error

조회 수: 2 (최근 30일)
Dilawar Khan
Dilawar Khan 2017년 5월 7일
댓글: Dilawar Khan 2017년 5월 7일
??? Error using ==> fileparts at 17
Input must be a row vector of characters.
Error in ==> wavread>open_wav at 193
[pat,nam,ext] = fileparts(file);
Error in ==> wavread at 65
[fid,msg] = open_wav(file);
Error in ==> comparing at 10
z=wavread(record);
Error in ==> voice at 10
comparing(sample_freq);
my program is this
function[z]=comparing(sample_freq)
record_len = 2; %Record time length in seconds
open_lock='test';
sample_time = sample_freq * record_len;
disp('kindly speak to open the lock');
f = sprintf('%s.wav',open_lock);
input('Press enter when ready to record--> ');
record = wavrecord(sample_time, sample_freq); %Records the input through the sound card to the variable with specified sampling frequency
wavwrite(record, sample_freq, f);
z=wavread(record);
x=z;
can some one help me ,thanks alot
  댓글 수: 1
Guillaume
Guillaume 2017년 5월 7일
What version of matlab are you using? The last version of matlab that had wavrecord was R2013b. Time to upgrade?

댓글을 달려면 로그인하십시오.

답변 (2개)

Walter Roberson
Walter Roberson 2017년 5월 7일
z = wavread(f);
  댓글 수: 1
Dilawar Khan
Dilawar Khan 2017년 5월 7일
yes its work ,thankx alot bro :)

댓글을 달려면 로그인하십시오.


Guillaume
Guillaume 2017년 5월 7일
I suspect you want
z = wavread(f);
%and what's the point of x=z on the next line. Read the file as x directly if you must
%better use variable names that have meaning
The output of wavrecord is not a file name, so I don't understand why you tried to pass to wavread.
Note that wavrecord has not been part of matlab since R2014a.
  댓글 수: 1
Dilawar Khan
Dilawar Khan 2017년 5월 7일
thnkx i understand your point i will use variable

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Code Generation and Deployment에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by