Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem with updation in datetick

Status
Not open for further replies.

ak501

Computer
Oct 27, 2005
4
0
0
DE
I have probelm using dateticks


I plot 399 values of y,z against 399 time values in x

It starts well by begining at first value of x, but as it goes on plotting the the plot gets compressed due to the dates. And I am not able to handle these dates with datetick function.

I wanted to plot only for the values in x and only plot till the values I am plotting. I was trying to aviod the space it was giving at start and end of the plot.

here is the code I use.

function plot_example

x=textread('times.txt');
x=datenum(x);
x=flipud(x);

y=rand(size(x,1),1);
z=rand(size(x,1),1);

a=[];
b=[];
c=[];
figure(2)
hold on

for i = 1:size(x,1)

a=[a;x(i)];
b=[b;y(i)];
c=[c;z(i)];

plotting(datenum(a),b,'r')
plotting(datenum(a),c,'b')


end


function plotting(xx,yy,colors)

plot(xx,yy,colors)
datetick('x',21)
drawnow
 
Status
Not open for further replies.
Back
Top