Combining vectors of day, month and year into a single date vector
조회 수: 32(최근 30일)
표시 이전 댓글
Hi I have a set of data as an ASC file set up with 4 columns one has my data, the other three are the day (1-31), month (1-12) and year (1700-2000). How can I combine the day month and year into a single vector so that I can plot my data against the date in MATLAB?
So far I have imported each separate column into a vector but I am struggling to work out how to convert this into a vector of dates that I can actually use, any ideas?
댓글 수: 0
채택된 답변
Lucas García
2011년 9월 19일
dates = datenum([year,month,day]);
Then you can plot your data vs. dates.
Finally, use datetick to change the format of your dates' axis.
For example:
datetick('x','mmmyy')
추가 답변(0개)
참고 항목
범주
Find more on Dates and Time in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!