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

1 visualización (últimos 30 días)
Katherine Varga
Katherine Varga el 13 de Feb. de 2018
Respondida: Peter Perkins el 15 de Feb. de 2018
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 comentario
Jeremy Hughes
Jeremy Hughes el 13 de Feb. de 2018
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

Iniciar sesión para comentar.

Respuestas (2)

Katherine Varga
Katherine Varga el 14 de Feb. de 2018
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 el 15 de Feb. de 2018
Katherine, consider using readtable instead of xlsread. In recent versions, importing dates is much simpler than using xlsread.

Categorías

Más información sobre Dates and Time en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by