Why am I getting an error " Function 'isfixed' is not defined for a first argument of class double." while integrating in a matlab function block in simulink.

1 view (last 30 days)
This is the code that I have put in the matlab function block . Its a 2 input 5 output function. I am getting an error "Function 'isfixed' is not defined for a first argument of class double." . Any help is appreciated.
function [x1,x2,theta,v1,v2] = fcn(u1,u2,u3)
%#codegen theta = double(int(u2));
v1=u1*cos(theta);
v2=u1*sin(theta);
x1=double(int(v1,theta));
x2=double(int(v2,theta));

Answers (1)

Mike Hosea
Mike Hosea on 31 Aug 2012
I was not even aware of this "int" function. Apparently it is deprecated and you are now supposed to use storedInteger(), or I guess what you need here is, rather, storedIntegerToDouble(). Anyway, the int function is being invoked on inputs that are not fixedpoint numbers. This may be a problem with your model, or it might be an issue related to the automatic determination of signal sizes. If it is the latter, you may be able to avoid the issue by going into the model explorer and specifying explicitly the sizes and types of the inputs u1 and u2 here rather than let these things be inherited.

Categories

Find more on Simulink Functions 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!