How to delete a plot in UIAxes?

1 vue (au cours des 30 derniers jours)
Eduardo Gaona Peña
Eduardo Gaona Peña le 2 Oct 2017
Commenté : David J. Mack le 7 Fév 2018
I'm using a button as a tool to plot one linear fit over a curve and I would like to replace the plot of the fit whenever I push the button again. I'm not quite sure how to use the delete command in this case. Any help is appreciated :)

Réponse acceptée

David J. Mack
David J. Mack le 3 Oct 2017
Modifié(e) : David J. Mack le 3 Oct 2017
You could store the handle to the fitted line in the UserData of the figure and then retrieve it every time the button is hit and use it to replace the YData of the line with the new fitted YData (this "replaces" the old line). Greetings, David
  2 commentaires
Jesus Velazquez
Jesus Velazquez le 1 Fév 2018
any chance you could share an example of this?
David J. Mack
David J. Mack le 7 Fév 2018
hFig = figure(); hPlot = plot(cfit); hFig.UserData.hPlot = hPlot; % Code to add the button
% in your callback hFig.UserData.hPlot.YData = newYData;

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Develop Apps Using App Designer dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by