Reading Excel named table doesn't work ?
20 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commento
JE101
il 20 Gen 2021
Modificato: JE101
il 20 Gen 2021
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.
Risposte (1)
Stephan
il 10 Nov 2020
data = readtable('test.xlsx')
results in:
data =
11×2 table
ID Data
__ _____
1 21324
2 345
3 123
4 -984
5 485
6 3845
7 1674
8 594
9 0.38
10 924
11 947
2 Commenti
Stephan
il 12 Nov 2020
I can only answer on what i get fromm you. Maybe attach the file you have trouble with, will help.
Vedere anche
Categorie
Scopri di più su Spreadsheets in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!