Why readtable is not reading all my rows, it has a limit?
60 ビュー (過去 30 日間)
古いコメントを表示
Estefany Patricia Vizuete Chacón
2024 年 5 月 13 日
コメント済み: Estefany Patricia Vizuete Chacón
2024 年 5 月 13 日
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 件のコメント
回答 (1 件)
Steven Lord
2024 年 5 月 13 日
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)
参考
カテゴリ
Help Center および File Exchange で Data Import and Analysis についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!