필터 지우기
필터 지우기

convert dates in matlab

조회 수: 2 (최근 30일)
Sana Ejaz
Sana Ejaz 2019년 6월 17일
댓글: Star Strider 2019년 6월 17일
Hi all,
Need urgent help. I have dates in excell in a format of 19800101(this is 1st jan 1980).
I want to convert them to datenum in matlab.I have attached the excell file with the date column.
I want to convert dates in this column to matlab dates of any format.I tried converting it using different functions but failed.
would someone be able to help?

채택된 답변

Star Strider
Star Strider 2019년 6월 17일
Try this:
D = xlsread('dates.xlsx');
Ds = num2str(D,'%d');
Dn = datenum(Ds, 'yyyymmdd');
Check = datevec(Dn) % Check Conversion (Delete Later)
The first five :
Check =
1986 1 2 0 0 0
1986 1 3 0 0 0
1986 1 6 0 0 0
1986 1 7 0 0 0
1986 1 8 0 0 0
  댓글 수: 2
Sana Ejaz
Sana Ejaz 2019년 6월 17일
Thanks Alot it worked.
Star Strider
Star Strider 2019년 6월 17일
As always, my pleasure.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by