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!

답변 (3개)

Wayne King
Wayne King 2012년 5월 25일

0 개 추천

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 2012년 5월 25일

0 개 추천

I have tried but cant manage to work it out. I will try again now
Jamie
Jamie 2012년 5월 25일

0 개 추천

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

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

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Dates and Time에 대해 자세히 알아보기

질문:

2012년 5월 25일

Community Treasure Hunt

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

Start Hunting!

Translated by