Filter löschen
Filter löschen

How to delete a plot in UIAxes?

4 Ansichten (letzte 30 Tage)
Eduardo Gaona Peña
Eduardo Gaona Peña am 2 Okt. 2017
Kommentiert: David J. Mack am 7 Feb. 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 :)

Akzeptierte Antwort

David J. Mack
David J. Mack am 3 Okt. 2017
Bearbeitet: David J. Mack am 3 Okt. 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 Kommentare
Jesus Velazquez
Jesus Velazquez am 1 Feb. 2018
any chance you could share an example of this?
David J. Mack
David J. Mack am 7 Feb. 2018
hFig = figure(); hPlot = plot(cfit); hFig.UserData.hPlot = hPlot; % Code to add the button
% in your callback hFig.UserData.hPlot.YData = newYData;

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Develop Apps Using App Designer finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by