Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
EraseMode of plot3

Subject: EraseMode of plot3

From: Liana

Date: 5 Apr, 2011 21:18:20

Message: 1 of 3

Hello,

At each step i of my simple animation, I need just to plot the line and erase all previous lines on that plot (to avoid the 'tail'). I tried to change the EraseMode, however the results were always the same. Any ideas?

Thanks a lot!

for i = 1 : len
    xlabel('x'); ylabel('y'); zlabel('z');
    view(30,30); grid on;
    hold on
    plot3(x,y,z,'b-','EraseMode','xor','MarkerSize',5); % plots the line
    patch('Faces',xFaces,'Vertices',xVertices,'FaceColor','r');
    hold off
    drawnow;
end

Subject: EraseMode of plot3

From: Liana

Date: 5 Apr, 2011 22:21:05

Message: 2 of 3

The problem is solved:
for i = 1 : len
    if i> 1
        delete(h1); % delete the line
    end
    h1 = plot3(x,y,z,'b-','EraseMode','normal','MarkerSize',10);
    %....
end
"Liana" wrote in message <ing0us$j7c$1@fred.mathworks.com>...
> Hello,
>
> At each step i of my simple animation, I need just to plot the line and erase all previous lines on that plot (to avoid the 'tail'). I tried to change the EraseMode, however the results were always the same. Any ideas?
>
> Thanks a lot!
>
> for i = 1 : len
> xlabel('x'); ylabel('y'); zlabel('z');
> view(30,30); grid on;
> hold on
> plot3(x,y,z,'b-','EraseMode','xor','MarkerSize',5); % plots the line
> patch('Faces',xFaces,'Vertices',xVertices,'FaceColor','r');
> hold off
> drawnow;
> end

Subject: EraseMode of plot3

From: Steven_Lord

Date: 6 Apr, 2011 14:44:38

Message: 3 of 3



"Liana " <liananapalkova@email.arizona.edu> wrote in message
news:ing0us$j7c$1@fred.mathworks.com...
> Hello,
>
> At each step i of my simple animation, I need just to plot the line and
> erase all previous lines on that plot (to avoid the 'tail'). I tried to
> change the EraseMode, however the results were always the same. Any ideas?
>
> Thanks a lot!
>
> for i = 1 : len
> xlabel('x'); ylabel('y'); zlabel('z');
> view(30,30); grid on;
> hold on plot3(x,y,z,'b-','EraseMode','xor','MarkerSize',5); % plots
> the line

DON'T create a new line each time. Create the line _once_ prior to entering
the FOR loop and SET the appropriate properties (XData, YData, ZData) of
that line's handle inside the loop.

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us