How can I read in dates stored as strings from an Excel sheet into MATLAB 7.0 (R14)?

6 views (last 30 days)
The release notes mention using a cell array to read in dates which are stored as strings from an Excel sheet. But I cannot find this specific date-reading syntax. The documentation on XLSREAD does not mention how to read in string date information from an Excel file.
I have an Excel file called Book1.xls which has a date value in cell A1 as a string. I use the following syntax but it only returns an empty matrix:
a = XLSREAD('Book1.xls','Sheet1');

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
This bug has been fixed in Release 2007b (R2007b). For previous product releases, read below for any possible workarounds:
Documentation on using XLSREAD to read in string format dates is missing from the manual.
Here is additional information on performing this:
You can use the dual output syntax of XLSREAD to retrieve string format dates from an Excel file. For example, the command
[numbers dates] = xlsread('Book1.xls','Sheet1');
returns the string dates in the Excel sheet in the variable 'dates'.
For more information on the different syntaxes of XLSREAD, execute the following at the MATLAB command prompt:
doc xlsread

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!