フィルターのクリア

How to delete a plot in UIAxes?

3 ビュー (過去 30 日間)
Eduardo Gaona Peña
Eduardo Gaona Peña 2017 年 10 月 2 日
コメント済み: David J. Mack 2018 年 2 月 7 日
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 :)

採用された回答

David J. Mack
David J. Mack 2017 年 10 月 3 日
編集済み: David J. Mack 2017 年 10 月 3 日
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 件のコメント
Jesus Velazquez
Jesus Velazquez 2018 年 2 月 1 日
any chance you could share an example of this?
David J. Mack
David J. Mack 2018 年 2 月 7 日
hFig = figure(); hPlot = plot(cfit); hFig.UserData.hPlot = hPlot; % Code to add the button
% in your callback hFig.UserData.hPlot.YData = newYData;

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDevelop Apps Using App Designer についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by