Why am I unable to receive date data from an Excel spreadsheet using the XLSREAD function in MATLAB 7.0 (R14)?

5 views (last 30 days)
When I use the XLSREAD function in MATLAB 7.0 (R14) to read data from an Excel spreadsheet that has a column of dates, the date information is not read in the same as it was previously using R13sp1. Under R13sp1, the date was returned as a number and under R14, it is returned as a string.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
This behavior is due to a change in XLSREAD for MATLAB 7.0 (R14), where the function now uses ActiveX to communicate with Excel. Under this method, the dates are returned to MATLAB as strings because Excel treats the dates as strings.
One possible workaround for this issue is to edit the Excel file and change the format of the date column to numeric. After saving the spreadsheet, you can read in the dates into MATLAB with XLSREAD.
Alternatively, you can invoke XLSREAD in 'basic' mode. This will result in XLSREAD using the same non-ActiveX approach to reading the file as was used in R13sp1, and the dates will be read as numbers. For more details about 'basic' mode, execute:
help xlsread

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!