using cla in a for loop

조회 수: 1 (최근 30일)
Zachary Reinke
Zachary Reinke 2018년 2월 22일
댓글: Zachary Reinke 2018년 2월 22일
I am trying to use the cla function to periodically clear my plot durring a for loop. The first set of data plot fine but once i call the cla function nothing else will plot for the remainder of the for loop. what can i do?
for i = 1:4:L
a = rem(i,1201);
if a == 0
cla
end
addpoints(h(1),U(2,i),U(3,i),U(4,i));
addpoints(h(2),W(2,i),W(3,i),W(4,i));
addpoints(h(3),R(2,i),R(3,i),R(4,i));
drawnow
end

채택된 답변

Stephen23
Stephen23 2018년 2월 22일
편집: Stephen23 2018년 2월 22일
When you call cla it removes everything in the axes, including the animated line. The you try to use addpoints to add points to that line... which no longer exists! Clearly this will not work.
Rather than cla perhaps you should try clearpoints: this removes the points from the line, but the line still exists (so you can add new points to it).
  댓글 수: 1
Zachary Reinke
Zachary Reinke 2018년 2월 22일
That was it!!! Thank you so much for the help and for responding so quickly!!!

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

추가 답변 (0개)

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by