×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

creating an animated plot

creating an animated plot

creating an animated plot

(OP)
Hello guys,

Here is the situation i am in.. I have stored like 20 values of X and Y Position from time 1sec to 20 sec in an excel sheet and I want my code to extract those and plot them for each time.and the plot should look animated. The best way to describe it that there is a car moving from from time 1 to 20 secs and i want to have its trajectory. Now i am able to do all that. I am more interested getting graphics..like say a huge ball represents that car and the ball moves every sec along those values..Please help as its urgent..

Thanks
Ashes.cfg

here is the code i have developed.. as u can see i am able to get the plot but I want a ball or any object to follow that path(ball represents my car in motion)..also attaching my values file

CODE

clc;
clear all;


num = xlsread('Value.xls')

Time = num(:,1);
% count = num of rows in the initial matrix - num or Time
%Time(count)
count=length(Time);

X=num(1,2);
Y=num(1,3);

hold on;

p = plot(X,Y)
axis([-10000 10000 -10000 10000])

for iCount = 2:count
    X(iCount)=num(iCount,2);
    %X
    Y(iCount)=num(iCount,3);
    %Y
  
    % Change coordinates
    set(p,'XData',X,'YData',Y);

%     refreshdata
%     drawnow
    pause(.5)
end

RE: creating an animated plot

Take a look at the "erasemode" property of the plot.  I don't have ML to hand right now, but I think "xor" might be what you want.

- Steve

RE: creating an animated plot

change your p=plot(x,y) to

p=plot(NaN,Nan,'O')

then do the XData, YData update.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources