MATLAB Answers

The curve fitting tool won't open when using the cftool command or when clicking on Curve Fitting in Apps. There is also an error message.

23 views (last 30 days)
Luca Mastrangelo
Luca Mastrangelo on 24 Feb 2020
Answered: Priyanshu Mishra on 27 Feb 2020
That's my code:
xvals = (-20:1:20)';
yvals = xvals.^2;
plot(xvals,yvals,'.','MarkerSize',20)
cftool(xvals,yvals)
Which gives me an error message:
Warning: Error occurred while executing the listener callback for event FitAdded defined for class sftoolgui.FitsManager:
Dot indexing is not supported for variables of this type.
Error in sftoolgui.Figure/addToDesktopGroup
Error in sftoolgui.Figure
Error in sftoolgui.FitFigure (line 59)
this = this@sftoolgui.Figure(sftool);
Error in sftoolgui.sftool/fitAdded (line 146)
fitFigure = sftoolgui.FitFigure(h, evt.HFitdev, []);
Error in sftoolgui.sftool>@(s,e)h.fitAdded(e) (line 83)
h.createListener(fm, 'FitAdded', @(s, e) h.fitAdded( e ) );
Error in sftoolgui.FitsManager/newFit (line 35)
notify (this, 'FitAdded', sftoolgui.FitEventData( hFitdev ));
Error in sftool_v1 (line 72)
h.HFitsManager.newFit( data );
Error in cftool>iStartSFTOOL (line 51)
application = sftool_v1( varaibles, names );
Error in cftool (line 41)
theApplication = iStartSFTOOL( varargin, names );
Error in LiveEditorEvaluationHelperE1999554706 (line 8)
cftool(xvals,yvals)
Error in matlab.internal.editor.evaluateRegions
Error in matlab.internal.editor.EvaluationOutputsService.evalRegions
Strangely, when I use the command f=fit(xvals,yvals,'poly2') it works. Why does the curve fitting toolbox doesn't open?

Answers (1)

Priyanshu Mishra
Priyanshu Mishra on 27 Feb 2020
Hi Luca,
It seems you have used script name as any of the MATLAB function. Try to rename the script (other than MATLAB keyword) and run it again.

Community Treasure Hunt

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

Start Hunting!

Translated by