MATLAB: Undefined function ‘eq’ for input arguments of type ‘struct’ using any custom equation in curve fitting tool

curve fittingCurve Fitting ToolboxMATLAB

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

Best Answer

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.
Related Question