update one plot in appdesigner

In appdesigner, I have multiple plots, I want to update one or more. The initial plot owrks, the update not. How to do this??
Many thx form you help.
hold(app.UIAxes, 'on');
h1 = plot(app.UIAxes,(1:20),'*');
h2 = plot(app.UIAxes,(3:30),'*');
hold(app.UIAxes, 'off');
pause(5);
set(h1, 'XData', (1:20), 'YData', (20:1));
drawnow;

 採用された回答

Rik
Rik 2022 年 6 月 20 日

0 投票

This code should work, once you fix the creation of the vector: 20:-1:1.

2 件のコメント

Leon
Leon 2022 年 6 月 20 日
Hello Rik,
Thx for your answer, I missed that one:-(
Rik
Rik 2022 年 6 月 20 日
No problem. It's a very easy mistake to make. I don't make it daily anymore, but I still ofter forget :-1:.
Maybe I should get in the habit of using :1: for upwards arrays, that way you can't forget :-1: when you need it.

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeStartup and Shutdown についてさらに検索

製品

リリース

R2020b

質問済み:

2022 年 6 月 19 日

コメント済み:

Rik
2022 年 6 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by