time series plot

I am trying to plot tidal level over time, but am struggling to get the date and time accurately along the X-axis. The time data is currently in a date vector format of 6 columns [dd mm yy hh mm ss]. What is the best way to convert this data into a format which can be plotted on the x-axis against water level? The matrix lengths are the same. Cheers!

Answers (3)

Wayne King
Wayne King on 25 May 2012
Did you use datenum and datetick?
t = (1900:10:1990)'; % Time interval
p = [75.995 91.972 105.711 123.203 131.669 ...
150.697 179.323 203.212 226.505 249.633]'; % Population
plot(datenum(t,1,1),p) % Convert years to date numbers and plot
datetick('x','yyyy') % Replace x-axis ticks with 4 digit year labels.
Jamie
Jamie on 25 May 2012

0 votes

I have tried but cant manage to work it out. I will try again now
Jamie
Jamie on 25 May 2012

0 votes

I've tried using datenum for the vector array to convert into a serial date number using DateNumberArray = datenum(DateVectorArray). It comes up with an error message when I try to input the matrix name in a string. It outputs a serial number for individual inputs, but not for the whole matrix. Can i use the datenum function for the entire matrix? Its made up of 6 columns (yy mm dd hh mm ss) and 43000 rows. Thanks for your help

2 Comments

Win co
Win co on 25 May 2012
post your data file and we will figure out
Jamie
Jamie on 26 May 2012
where/how do i post the file? sorry, i am new to this!

Sign in to comment.

Categories

Asked:

on 25 May 2012

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!