Why readtable is not reading all my rows, it has a limit?
40 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Estefany Patricia Vizuete Chacón
il 13 Mag 2024
Commentato: Estefany Patricia Vizuete Chacón
il 13 Mag 2024
I'm trying to read a table with the code
datos = readtable('tmy.xlsx');
datos(4:8763,1:15)
But when I see the read data in the workspace, a matrix of 8708x27 table appears when the original file is 8763x27. I tried to put the size but it comes out:
Error using ()
Row index exceeds table dimensions.
Error in tmy_datos_tratados (line 3)
datos(4:8763,1:15)
It should be noted that in the Excel file everything is in number format and there are no empty cells.
Please help me, thank you so much.
0 Commenti
Risposte (1)
Steven Lord
il 13 Mag 2024
I believe the presence of data in P56 makes MATLAB consider rows 1 through 55 as headers. Note that detectImportOptions considers your data to start in cell A56.
filename = 'https://www.mathworks.com/matlabcentral/answers/uploaded_files/1693421/tmy.xlsx';
IO = detectImportOptions(filename)
If I update the import options to indicate the data starts at A4 (and the variable names are in the third row)
IO.DataRange = 'A4';
IO.VariableNamesRange = 'A3';
T = readtable(filename, IO);
head(T)
size(T)
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!