필터 지우기
필터 지우기

Need to delete the previous points in a plot while plotting continously

조회 수: 20 (최근 30일)
Charan
Charan 2023년 11월 9일
댓글: Charan 2023년 12월 13일
During the matlb plotting of some set of points the previous points at previous time step should be deleted and continue with the further plotting.
x = [1,2,3,4,5];
y = [3,4,5,6,7];
plot(x,y,'-o');
so when its plotting for x(2) and y(2), the points of x(1) and y(1) should be deleted/unmarked on the plot.
  댓글 수: 2
Dyuman Joshi
Dyuman Joshi 2023년 11월 9일
Just to be clear - Do you to show one point at a time?
If yes, then what should be the time gap between consecutive points? Should the line be in the background?
If no, then please specify.
Charan
Charan 2023년 11월 9일
i want to show one point at a time and time gap between consecutive points can be 1 second and line should be visible in background

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

채택된 답변

Dyuman Joshi
Dyuman Joshi 2023년 11월 9일
편집: Dyuman Joshi 2023년 11월 9일
Change colors and other properties as you like/prefer.
x = [1,2,3,4,5];
y = [3,4,5,6,7];
plot(x, y, 'r')
hold on
h = animatedline('Marker', 'o', 'Color', 'k');
xlim([0 10])
ylim([0 10])
for k=1:numel(x)
addpoints(h, x(k), y(k));
pause(1)
drawnow
clearpoints(h)
end
  댓글 수: 3
Dyuman Joshi
Dyuman Joshi 2023년 11월 9일
You are welcome!
If my answer solved your problem, please consider accepting the answer.
Charan
Charan 2023년 12월 13일
Hi this concept of erasing the previous points can be achieved without using the animated line function. Because i see this clearpoints cannot be used without using the animated line function. So is there any other method to work on this?

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Graphics Performance에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by