Converting Matlab time vector into fractional year date

조회 수: 6 (최근 30일)
Jonathan
Jonathan 2014년 2월 7일
댓글: Azzi Abdelmalek 2014년 2월 7일
I feel ridiculous asking this, but is there a single function in Matlab that takes a series of integers/vectors (e.g. [2012,1,1,10,30,03]) or a Matlab time number (e.g. 735630) and converts it into a usable and plottable date of form 2012.01231 in one step? Thanks!

답변 (1개)

Azzi Abdelmalek
Azzi Abdelmalek 2014년 2월 7일
편집: Azzi Abdelmalek 2014년 2월 7일
What do you mean by plotable ?
There are many functions related to dates
doc datenum
doc datevec
doc datestr
  댓글 수: 9
James Tursa
James Tursa 2014년 2월 7일
편집: James Tursa 2014년 2월 7일
Maybe OP would want something like this (with modifications to make it generic):
2014+(datenum(d) - datenum('1-jan-2014'))/(datenum('1-jan-2015') - datenum('1-jan-2014'))
Azzi Abdelmalek
Azzi Abdelmalek 2014년 2월 7일
What about time between 0 and 1?
date1='01-01-2000'
date2='01-01-2001'
dat=datenum(date1,'dd-mm-yyyy'):datenum(date2,'dd-mm-yyyy')
out=mat2gray(dat)

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

카테고리

Help CenterFile Exchange에서 Time Series Objects에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by