error in embedded matlab function

2 views (last 30 days)
studentU on 28 Apr 2015
Commented: studentU on 30 Apr 2015
hi, i have 3 function.m, i use it to develop embedded matlab-function , But it generates this error:
>> Undefined function or method 'fnct1' for input arguments of type'double'
what is the causes? and how can i resolve this error? thanks.

Answers (3)

pfb on 28 Apr 2015
Edited: pfb on 28 Apr 2015
Matlab is complaining because it cannot find fnct1. This is the typical answer you get when you use a function that does not exist. Just type
I assume that fnct1 is the name of one of your functions.
Where and how do you define that function?
You mention .m files. Is the fnct1.m file in your working directory, or anywhere in matlab known path?
pfb on 29 Apr 2015
Edited: pfb on 29 Apr 2015
Uhm, I see that you define fnct1 (in fnct1.m, if I get it right) but then you feed 'fcnt1' into coder.extrinsic.
Same bunch of letters, different order :)
You mistyped "fcnt1" instead of "fnct1".
I guess that's why matlab is complaining.

Sign in to comment.

studentU on 29 Apr 2015
Edited: studentU on 29 Apr 2015
i'm sorry, i was wrong, but it generate the sme error!!!!
  1 Comment
pfb on 29 Apr 2015
you should pay more attention if you want other people's help.
Why did you answer your own question instead of my comment now? This produces even more confusion!
Are you sure there are no typos in the argument of coder.extrinsic? Are you sure that you used the single quotes?
I'm not sure of anything now, since what you pasted is not really your code...

Sign in to comment.

studentU on 29 Apr 2015
Edited: studentU on 30 Apr 2015
Here it is my program with some reduction but the point is that, I just tried to simplify your understanding, but it appears that I commit typos ....
function [az, el, de, ho] = fnct1 (ta, tm, tj, th, ti, ts, lo, la, orl, al, ut)
az = ta + tm; el = th + ti + tj; de = lo- ts; ho = la+orl-ut *al ;
%% funct2.m
function [in] = fnct2 (el, az, the paragraph, from, ho)
syms in
in=solve('[sin(la)*sin(de)+cos(hor)]*cos(in)- [cos(al)*sin(de)*cos(la)+cos(de)*sin(al)*sin(hor)]*sin(in)=1');
%% funct3.m
function [or] = fnct3 (el, az, in)
syms or
or = solve ('cos (in) * sin (el) - [sin (b) * cos (e) * cos (az)] * cos (or) -
[sin (az) * sin (in) * cos (e)] * sin (or) = 1 ');
%%in blocks embedded matlab-function,
function [Cor, Cin] = fnct4 (ta, tm, tj, th, ti, ts, lo, orl,la, al, ut)
[az, el, de, ho] = fnct1 (ta, tm, tj, th, ti, ts, lo, la, orl, al, ut)
Cin = fminbnd(fin, Imin, Imax)
fori=matlabfunction(fcnt3);%hundl function
Cor = fminbnd(fori, Omin, Omax)
thank's for your patience
studentU on 30 Apr 2015
for lack of space, I have a concern to past the comments correctly. but be sure that typos do not occur in the program.

Sign in to comment.


Find more on Loops and Conditional Statements in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!