필터 지우기
필터 지우기

Getting error of Double

조회 수: 2 (최근 30일)
moonman
moonman 2011년 10월 6일
This is portion of my code
function [dtmf]=dtmfdial(x,fs);
%This function produces DTMF Tone corresponding to given
%key number
%abcdefg=input key numbers
%fs= The sampling frequency
lfg = [697 770 852 941]; % Low frequency group
hfg = [1209 1336 1477]; % High frequency group
f = [];
for c=1:4,
for r=1:3,
f = [ f [lfg(c);hfg(r)] ];
end
end
table=f';
dur=.5;
tt=0:(1/fs):dur;
n=length(x);
C=cell(1,length(x));
for k=1:n
if x(k)==1
freqa=table(1,1);
freqb=table(1,2);
else if x(k)==2
freqa=table(2,1);
freqb=table(2,2);
and so on
When i run this function i get this error
>> dtmf=dtmfdial([1 2 3 4 5 6 7],8000)
??? Undefined function or method 'dtmfdial' for input arguments of type 'double'.

채택된 답변

Wayne King
Wayne King 2011년 10월 6일
Hi, are you actually assigning anything to dtmf inside your function?
For example, if you wrote a function
function test = test_func(x)
test1 = x+1;
And called that function at the command line:
y = test_func(4);
You would get that error message, because you assign the output to test1 inside the function, but the function is set up to return test.
  댓글 수: 1
moonman
moonman 2011년 10월 6일
Thanks a lot King

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

추가 답변 (3개)

Honglei Chen
Honglei Chen 2011년 10월 6일
Is your dtmfdial on path? You can also try
rehash toolbox
to regenerate the path.
HTH

Laura Proctor
Laura Proctor 2011년 10월 6일
Try the command
which dtmfdial
at the command window. Perhaps the function is not on your path or you have a variable with the name dtmfdial. This will let you know why it's not working.

moonman
moonman 2011년 10월 6일
Ok my this prblem is solved and i am listening tones but i am getting one error at end after listening the tones
??? Output argument "dtmf" (and maybe others) not assigned during call to "E:\Installed\Matlab 2011\Work\DTMF\dtmfdial.m>dtmfdial".

Community Treasure Hunt

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

Start Hunting!

Translated by