ashwinsamant
Electrical
- Mar 22, 2008
- 1
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
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