How can i update data in the figure window in MATLAB GUI using pushbutton callback?

조회 수: 1 (최근 30일)
I have MATLAB GUI, which plots data in figure using pushbutton callback
Even though the figure window is updating the data for every iteration inside the for loop, it is not able to hold and display the data from previous iteration of the for loop.
I have tried 'hold on' option but it does not work for the GUI case
How can i fix it.
  댓글 수: 6
VBBV
VBBV 2018년 11월 23일
there is no cla, clf in the loop, the code structure is shown below
for i = 1: N
...
for j = 1 :X
...
...
...
end
semilogx(...)
end

댓글을 달려면 로그인하십시오.

채택된 답변

Jan
Jan 2018년 11월 23일
편집: Jan 2018년 11월 23일
Instead of hold on prefer to create the axes with the wanted "accumulation" flag directly:
axes('NextPlot', 'add')
Now new line objects created by plot() do not replace the existing contents, but are added. Do this before the loop.
Does this help already?
  댓글 수: 1
VBBV
VBBV 2018년 11월 23일
편집: VBBV 2018년 11월 26일
okay, found the solution myself from mathworks help documentation,
use hold(ax,'on') after the plot i.e.
for i = 1: N
...
for j = 1 :X
...
...
...
end
semilogx(...)
hold(ax,'on')
end
and it works fine, Thanks anyway for the response

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by