The handle h contains both points to just update one change
set(h,'xData',x(i));
to
set(h(1),'xData',x(i));
(when testing the 'o' was the first entry)
Pergunta
Please help me on this. I have both the points 'o' and 'x' moving. I want only the 'o' to move and the 'x' to be constant.
% animation_point.m
clear; close all;
% Create data
t = 0:0.001:1; % Time data
x = sin(2*pi*t); % Position data
y = cos(2*pi*t);
% Draw initial figure
figure(1);
set(gcf,'Renderer','OpenGL');
h = plot(x(1),0,'o', 0,y(1),'x');
set(h,'EraseMode','normal');
xlim([-1.5,1.5]);
ylim([-1.5,1.5]);
% Animation Loop
i = 1;
while i<=length(x)
set(h,'xData',x(i));
drawnow;
i = i+1
end
Solução
The handle h contains both points to just update one change
set(h,'xData',x(i));
to
set(h(1),'xData',x(i));
(when testing the 'o' was the first entry)