Publish a plot with Tools menu specifications

I'm trying to use a linear fit with a my data plot, but when I publish it only plots the data points.
Is there some code that does the same thing as the Tools menu?

Respuestas (1)

Aniket
Aniket el 11 de Jun. de 2025
Editada: Aniket el 11 de Jun. de 2025

0 votos

Yes, the interactive tools (eg. Data Fitting) used in a figure window do not change the code in the original MATLAB file and thus do not reflect in the published file. Please follow below steps to get the updated code:
  1. Open the figure window in undocked mode.
  2. Use tools that are required for your use case.
  3. Navigate to File --> Generate Code.
  4. A new file is created with all the code for the updated figure.
  5. Change the name of the function on the first line from createfigure to something more specific, like censusplot. Save the code file to your current folder with the file name censusplot.m
  6. Use this function in original file to reproduce the plot with the new data as arguments
  7. Publish your file
You can find more details regarding interactive fitting in this documentation: https://www.mathworks.com/help/matlab/data_analysis/interactive-fitting.html
I hope this helps!

Categorías

Más información sobre Linear and Nonlinear Regression en Centro de ayuda y File Exchange.

Preguntada:

el 23 de Mzo. de 2017

Editada:

el 11 de Jun. de 2025

Community Treasure Hunt

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

Start Hunting!

Translated by