how refresh chart in the function?

hi, i use function to draw in app designer
app (paramter of bubu function) is a reference's graph
i use in the function "close all" and "refres variable" but if i call bubu function for second time i see the old line plotted
function bubu(app)
close all;
clearvars -except app
for i:1:1000
plot(app...,)
end
end

 採用された回答

Voss
Voss 2023 年 9 月 10 日
編集済み: Voss 2023 年 9 月 10 日

0 投票

Use cla() to clear the axes:

function bubu(app)
      cla(app.simulaz_UIAxes_Eq,'reset')
      for i = 1:1000
          plot(app...,)
      end
end

2 件のコメント

pipor
pipor 2023 年 9 月 10 日
thank you
Voss
Voss 2023 年 9 月 10 日
You're welcome!

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

その他の回答 (1 件)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2023 年 9 月 10 日

0 投票

Use refresh() function to get your plot refreshed - See DOC

4 件のコメント

pipor
pipor 2023 年 9 月 10 日
refresh(app.simulaz_UIAxes_Eq)
Error using refresh
Handle does not refer to a figure object
Error in bubu (line 222)
refresh(app.simulaz_UIAxes_Eq)
Error in Predator_Equity/CalcolaButtonPushed (line 435)
bubu(app);
Error in matlab.apps.AppBase>@(source,event)executeCallback(ams,app,callback,requiresEventData,event) (line 62)
newCallback = @(source, event)executeCallback(ams, ...
Error while evaluating Button PrivateButtonPushedFcn.
Sulaymon Eshkabilov
Sulaymon Eshkabilov 2023 年 9 月 10 日
How to use refresh():
H=figure;
plot(t, y);
refresh(H)
pipor
pipor 2023 年 9 月 10 日
pipor
pipor 2023 年 9 月 10 日
編集済み: pipor 2023 年 9 月 10 日
i try with 2 version:
for i=1:r
col=rand(3,1,1)';
hp1=plot(Ax_Eq,XDates,TEE1(i,:),'DisplayName','OneContract','Color',col);
refresh(hp1)
text(Ax_Eq,c,TEE1(i,end)," xx",'Color',col);
end
and
for i=1:r
col=rand(3,1,1)';
hp1=plot(Ax_Eq,XDates,TEE1(i,:),'DisplayName','OneContract','Color',col);
refresh(app.simulaz_UIAxes_Eq)
text(Ax_Eq,c,TEE1(i,end)," xx",'Color',col);
end
the same error

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

カテゴリ

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

質問済み:

2023 年 9 月 10 日

コメント済み:

2023 年 9 月 10 日

Community Treasure Hunt

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

Start Hunting!

Translated by