Curve Fitting Toolbox    

Saving Your Work

The Curve Fitting Toolbox provides you with several options for saving your work. For example, as described in Saving the Fit Results, you can save one or more fits and the associated fit results as variables to the MATLAB workspace. You can then use this saved information for documentation purposes, or to extend your data exploration and analysis. In addition to saving your work to MATLAB workspace variables, you can

Before performing any of these tasks, you may want to remove unwanted data sets and fits from the Curve Fitting Tool display. An easy way to do this is with the Plotting GUI. The Plotting GUI shown below is configured to display only the census data and the best fit, poly2.

Saving the Session

The curve fitting session is defined as the current collection of fits for all data sets. You may want to save your session so that you can continue data exploration and analysis at a later time using the Curve Fitting Tool without losing any current work.

Save the current curve fitting session by selecting the menu item File->Save Session from the Curve Fitting Tool. The Save Session dialog is shown below.

The session is stored in binary form in a cfit file, and contains this information:

To avoid saving unwanted data sets, you should delete them from the Curve Fitting Tool. You delete data sets using the Data Sets pane of the Data GUI. If there are fits associated with the unwanted data sets, they are deleted as well.

You can load a saved session by selecting the menu item File->Load Session from the Curve Fitting Tool. When the session is loaded, the saved state of the Curve Fitting Tool display is reproduced, and may display the data, fits, residuals, and so on. If you open the Fitting GUI, then the loaded fits are displayed in the Table of Fits. Select a fit from this table to continue your curve fitting session.

Generating an M-File

You may want to generate an M-file so that you can continue data exploration and analysis from the MATLAB command line. You can run the M-file without modification to recreate the fits and results that you created with the Curve Fitting Tool, or you can edit and modify the file as needed. For detailed descriptions of the functions provided by the toolbox, refer to Function Reference.

If you have many data sets to fit and you want to automate the fitting process, you should use the Curve Fitting Tool to select the appropriate model and fit options, generate an M-file, and then run the M-file in batch mode.

Save your work to an M-file by selecting the menu item File->Save M-file from the Curve Fitting Tool. The Save M-File dialog is shown below.

The M-file can capture this information from the Curve Fitting Tool:

You can recreate the saved fits in a new figure window by typing the name of the M-file at the MATLAB command line. Note that you must provide the appropriate data variables as inputs to the M-file. These variables are given in the M-file help.

For example, the help for the censusfit M-file indicates that the variables cdate and pop are required to recreate the saved fit.


  Analyzing the Fit Importing, Viewing, and Preprocessing Data