Can you save a cfit object (created programmatically using the 'fit' function) as a .sfit file to be opened in the curve fitting app?
14 views (last 30 days)
Show older comments
William Renold-Smith
on 14 Nov 2023
Commented: William Renold-Smith
on 21 Nov 2023
I want to write some code where an inital attempt at curve fitting is done programatically, with an option for a user to open the fit in the curve fitting app which will allow them to play with the fit?
I have been unsucsessfull in using the following syntax as although it does create a .sfit file, that file is not recognised when i attempt to load it into the curve fitting app.
Where DataFit is the object resulting from use of the 'fit' function.
save MyFit.sfit DataFit
0 Comments
Accepted Answer
Drew
on 15 Nov 2023
The short answer is "no". As of R2023b, you cannot save a cfit object (created programmatically using the 'fit' function) as a .sfit file to be opened in the curve fitting app.
What you can do, to get closer to the functionality you are looking for, is to use the Curve FItter app launching options shown at https://www.mathworks.com/help/curvefit/curvefitter-app.html
Some use cases to mention:
(1) If the Curve Fitter app is not open,
>> load carsmall
>> curveFitter(Horsepower, MPG)
will launch the Curve Fitter app and create a default fit using the provided x and y data. In the app, you can then change the fit to the desired type. This gets the data into the app from the CLI.
(2) If the Curve Fitter app is already open, then any new call to curveFitter with data arguments
>> curveFitter(Horsepower, MPG, Acceleration)
will switch focus to the Curve Fitter app and will add a fit to the existing in-app Table of Fits, using the provided data (which, in general, could include x, y, z, and w). In the app, you can then change the fit to the desired type. Again, this gets the data into the app from the CLI.
(3) The Curve Fitter app can be launched/opened with any saved Curve Fitter app session.
curveFitter('CurveFitterAppSavedSession.sfit')
This saved Curve Fitter app session could contain particular fits and fit options of interest. New fits with those fit types and fit options can be created in the app by duplicating the fit of interest, and then changing the data selection for that duplicated fit.
In conclusion, while the functionality you are requesting is not currently available, there are some options that partially provide the desired convenience.
If you find this answer helpful, please remember to accept the answer.
More Answers (0)
See Also
Categories
Find more on Get Started with Curve Fitting Toolbox 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!