How Can I Load and Format Dates in MATLAB from an Excel or Text File?

  • Context: MATLAB 
  • Thread starter Thread starter carlosvelcab
  • Start date Start date
  • Tags Tags
    Load Matlab
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 6K views
carlosvelcab
Messages
4
Reaction score
0
hi every one, I have a problem for load dates in matlab, I have 2488 dates
in xls file and txt file but I can't make that MATLAB read the number as a dates? Does anybody know how to do it?
for example I have this:
2000 03 01
2000 04 01
2000 05 01
2000 06 01
.
.
.

And I want that MATLAB shows me

03-Jan-2000
04-Jan-2000
05-Jan-2000

please help me
 
Physics news on Phys.org
++ Firstly, you need to convert string to date-type variable by using datenum.
Ex: datenum('2000 03 01', 'yyyy dd mm')

++ Secondly, using datestr:
Ex: datestr(time, 'mmmm dd, yyyy')

Combining: datestr(datenum('2000 03 01', 'yyyy dd mm'), 'mmmm dd, yyyy')

Hope this helps