필터 지우기
필터 지우기

Plot not updating even after changing plot data

조회 수: 46 (최근 30일)
Arkaniva Sarkar
Arkaniva Sarkar 2021년 10월 24일
답변: Walter Roberson 2021년 10월 24일
I am plotting lines on a surface plot in a GUI and trying to update the lines by changing XData,YData and ZData, but the lines are not updating.
% example
plt = surf(X,Y,Z) %surface plot
hold on
line_plt1 = plot3([1 2],[1 3],[5 8],'r-');
if ishandle(line_plt1)
set(line_plt1,'XData',[2 3],'YData',[3 4],'ZData',[5 5])
drawnow
end
The plot data gets updated after using set(handles,'Name',Value,..) but somehow the plot is not updating even after the plot data is changed. I've tried using refreshdata and linkdata but that's also not working.
Can anyone suggest any other way to update the plot?
  댓글 수: 2
Chris
Chris 2021년 10월 24일
This code works fine for me. Can you see the line? Is it possible it's obscured by the surface, or that the axis limits are inappropriate?
Arkaniva Sarkar
Arkaniva Sarkar 2021년 10월 24일
It works in command window, but not in an axes in a GUI made with GUIDE. The XData, YData and the ZData changes but the plot is not re-plotted/re-displayed.

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

채택된 답변

Walter Roberson
Walter Roberson 2021년 10월 24일

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Visual Exploration에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by