MATLAB: Retrieve the figure from the surface fitting tool

plotsurface fitting tool

Hi,
I made a 3D plot and used the surface fitting tool to make a model of the surface. Now I want to save the plot in order to include it as a figure (jpeg, png, tiff or other) in my presentation (only the plot without the rest of the fitting tool)- I could not find how to do that.
Thanks for helping

Best Answer

If you generate code from your fit, and then run that code, it will produce the same set of plots that you originally had but in a standard MATLAB figure.
  1. In Surface Fitting Tool, select File->Generate Code.
  2. Save the file that this produces in the editor (it defaults to "createFit").
  3. In the Command Window, run the file you saved, using the same variables that you used for the fit:
createFit(myXData, myYData, myZData)
This will create a figure and from here you can use any of the normal export tools for capturing an image, e.g. Edit->Copy Figure or File->Save As.