How to clear a plot in app designer to plot it again with new results?

9 ビュー (過去 30 日間)
Bárbara Matos
Bárbara Matos 2022 年 5 月 10 日
コメント済み: Bárbara Matos 2022 年 5 月 10 日
Hello! I have an app in appDesigner (image 1). When I press the button "Couplig Relations", there is a method which is done and when it finishes, it plot some figures (image 2). The problem is if I change the fields "Number of iterations" or "Error threshold" and I press the "Coupling Relations" button again, I want that the previous plots desapear and I the end plot the new ones.
At the moment I am trying to use cla (image 3), but it doesn't work (image 4). Have you got some suggestion? Thank you so much!
  2 件のコメント
Kevin Holly
Kevin Holly 2022 年 5 月 10 日
Are you programatically creating your axes? Are app.Error and app.Plot1 UIAxes handles?
Bárbara Matos
Bárbara Matos 2022 年 5 月 10 日
編集済み: Bárbara Matos 2022 年 5 月 10 日
Yes!
(I changed the name of Plot1 to RadiationDiagram)

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

採用された回答

Kevin Holly
Kevin Holly 2022 年 5 月 10 日
編集済み: Kevin Holly 2022 年 5 月 10 日
It seems like you are creating new uiaxes on top of the previous ones. You can go through your code to make sure you aren't creating new uiaxes.
Alternatively, I would suggest creating the uiaxes on the canvas with App Designer's UI. You can make the UIAxes invisible at first.
When you want to use the uiaxes, you can type the following:
app.UIAxes.Visible = 'on';
If you want to change the position of the uiaxes, you can move it as before:
app.UIAxes.Position = [400*app.left 9.5*app.bottom 399 317];
If you want to clear the axes, you can type
cla(app.UIAxes)
  1 件のコメント
Bárbara Matos
Bárbara Matos 2022 年 5 月 10 日
Oh, I understood. I was always creating the uiaxes. Thank you very much!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by