필터 지우기
필터 지우기

Can you save a cfit object (created programmatically using the 'fit' function) as a .sfit file to be opened in the curve fitting app?

조회 수: 17 (최근 30일)
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

채택된 답변

Drew
Drew 2023년 11월 15일
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.
  댓글 수: 1
William Renold-Smith
William Renold-Smith 2023년 11월 21일
Thank you for the response, you have helped to some extent. I suspect that for the functionality i'm looking for to work i would need to extract the relevent data from the '.sfit' file using the command line interface.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Fit Postprocessing에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by