Trouble importing Excel files into Matlab
2 次查看(过去 30 天)
显示 更早的评论
Hi I'm using this code to import an Excel file into Matlab:
[data,text]=xlsread('excelfile.xls','Sheet1');
And I'm trying to get all the data in the workspace item "data" and all text and date in the item "text". The problem is that Matlab doesn't seem to recognize my dates as dates so it doesn't put them into the "text" item.
Any idea?
0 个评论
回答(1 个)
Walter Roberson
2016-1-4
Excel dates are numeric values to which a date cell format has been applied. They read in as numeric, and then you have to convert the numeric values because they does not have the same origin time as MATLAB does.
If you have R2013b or later you can use readtable(), and especially if you have R2014b or later then readtable() will recognize them as dates and convert them to datetime objects in the table.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Import from MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!