Reading Excel named table doesn't work ?
16 次查看(过去 30 天)
显示 更早的评论
I was trying to read an Excel named table as the documentation of readtable recomend but it doesn't seem to work.
More specificly, with the file that I provided I tried
data = readtable('test.xls', 'Range', 'table');
MATLAB tells me that the range table doesn't exist even though it does. Am I forced to hard code the range (in this case A1:B12) ?
Edit: test.xlsx is a simple spreadsheet that reproduces the behaviour. The real file I'm working on has several tables over multiple sheets that may grow in size later. So I'm interested in being able to refer to the table I'm interested in directly.
1 个评论
JE101
2021-1-20
编辑:JE101
2021-1-20
I'd be keen to know if anyone has a fix for this too - I've run in to the same problem. As a partial workaround, you can use the old "xlsread" function. Oddly, this does recognise tables defined in Excel. The code would then be:
[numdata, textdata, celldata] = xlsread('test.xlsx', 1, 'table');
The 1 indicates that it's on the first sheet - indicating the sheet seems to be a necessary input (the code doesn't work without it).
Note that this codes doesn't seem to read in the column titles (even in the textdata or celldata) - it only reads in the data in the table.
And I've only tried this with ".xlsx" files. I don't know if it works with ".xls" files.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spreadsheets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!