Undefined function 'eq' for input arguments of type 'struct' using any custom equation in curve fitting tool

6 views (last 30 days)
Matlab 2016a on Win10.
I'm experiencing a weird problem with the curve fitting tool: whenever I try to fit to a custom equation, the result is "Undefined function 'eq' for input arguments of type 'struct'". It happens even if I do a clean start of Matlab, define two simple vectors (e.g. x = 1:10, y = x.^2) and then try to fit to a custom equation, whatever the equation is.
I suspect that somewhere a symbol as been redefined and breaks the fitting tool code, but my startup.m is empty and I don't know where else to look.
To debug the issue, I tried to do the same thing programatically. To avoid mistakes on my end, I just copied a matlab help example, but got the same error when defining the fittype:
>> fittype('a*time^2+b*time+c','independent','time','dependent','height')
Undefined operator '==' for input arguments of type 'struct'.
Error in symvar (line 26)
[b,e] = findrun(s==' ');
Error in fittype>iCreateCustomFittype (line 463)
variableNames = symvar( obj.expr );
Error in fittype>iCreateFittype (line 351)
obj = iCreateCustomFittype( obj, varargin{:} );
Error in fittype (line 328)
obj = iCreateFittype( obj, varargin{:} );
I'll kep digging into the matlab code, but I'd appreciate if someone had an idea of what's going on...
Thanks

Accepted Answer

Walter Roberson
Walter Roberson on 19 Oct 2016
Try
restoredefaultpath
and then try again. If it works then you have a path problem; quit MATLAB, re-enter, and use pathtool to look at what your path is like and look for .m files in those that might be interfering.
  1 Comment
Giacomo Ciani
Giacomo Ciani on 19 Oct 2016
Got it! Thanks so much! Now I have to figure out what is interfering, but at least I know where to look...
(and I will avoid commenting on why Matlab has to have this ridiculous problem...)

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!