how refresh chart in the function?

2 次查看(过去 30 天)
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

Use cla() to clear the axes:

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

更多回答(1 个)

Sulaymon Eshkabilov
Use refresh() function to get your plot refreshed - See DOC
  4 个评论
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

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Analysis, Benchmarking, and Verification 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by