Create a time vector from 01/01/1953 to 10/10/2010
조회 수: 3 (최근 30일)
이전 댓글 표시
Hello I am a beginner on matlab and I would like to create a time vector from 01/01/1953 to 10/10/2010. Then convert them to Julian day. Thank you
댓글 수: 2
Stephen23
2021년 12월 17일
편집: Stephen23
2021년 12월 18일
Here is a time vector that exactly fulfills your specification:
D = datetime([1953,2020],[1,10],[1,10])
It is a vector going from 01/01/1953 to 10/10/2010. Because you did not specify the step size, it has a completely randomly selected step of 594096 hours, which just coincidentally happens to be the exact difference between those dates.
TIP: do NOT use outdated and deprecated DATENUM nor DATEVEC. Using robust DATETIME objects is much better:
dt = datetime(1953,1,1):calyears(10):datetime(2010,10,10)
jd = juliandate(dt)
Eric Sofen
2022년 4월 12일
@Stephen, thanks for steering folks away from datenum and toward datetime.
You can also use the convertTo datetime function to get Julian dates, among other time conversions. The juliandate function lives in the Aerospace toolbox.
dt = datetime(1953,1,1):calyears(10):datetime(2010,10,10);
jd = convertTo(dt,"juliandate")
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Dates and Time에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!