Importing dates from Excel using Matlab 2012a
Mostra commenti meno recenti
Hello, I have been using xlsread with the 2012a release and I am very happy with it, except that I can't figure out how to get it to import the date properly. I have tried changing the excel column with the dates to a few different formats, but it always converts it to a number. I have also tried both the xlsx and xls formats for my input file. An example of my problem would be: importing 4/1/2012 gives the value 41000 in the 'num' and 'raw' arrays. Any help or workaround would be greatly appreciated, Ricardo
Risposte (2)
Ken Atwell
il 20 Apr 2012
1 voto
Importing dates "as dates" is only directly handled on Windows when Excel is also installed. On Mac (even when Excel is installed) and Linux, or on Windows when Excel is not installed, you need to do this conversion yourself.
See When to Convert Dates from Excel Files in the documentation for MATLAB for information on how to do this.
Walter Roberson
il 20 Apr 2012
0 voti
Excel stores dates as numbers.
There is a MATLAB File Exchange contribution to convert Excel dates to serial datenum values, after which you can datestr() if you want to.
Categorie
Scopri di più su Spreadsheets in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!