Reading Excel named table doesn't work ?
조회 수: 15 (최근 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.
답변 (1개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Spreadsheets에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!