How to specify a date string format when using xlsread from Excel?

When I use xlsread to import dates, I receive the following warning: Warning: Successfully read the date/time strings using the format 'MM/dd/uuuu', but their format is ambiguous and could also be 'dd/MM/uuuu'. Specify a format string to avoid ambiguity.
How do I specify a date format when reading dates from Excel? I do not see an option to do so in xlsread.

댓글 수: 1

Hi Kathrine,
Can you share some code? and a file? I'm not sure this is coming from XLSREAD. As far as I know, XLSREAD treats dates as text.
Jeremy

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

답변 (2개)

Katherine Varga
Katherine Varga 2018년 2월 14일

1 개 추천

Oh I see, it was coming from the datetime function I was using when converting the string I had imported from Excel. Thank you.
Peter Perkins
Peter Perkins 2018년 2월 15일

0 개 추천

Katherine, consider using readtable instead of xlsread. In recent versions, importing dates is much simpler than using xlsread.

카테고리

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

질문:

2018년 2월 13일

답변:

2018년 2월 15일

Community Treasure Hunt

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

Start Hunting!

Translated by