Why readtable is not reading all my rows, it has a limit?
조회 수: 60 (최근 30일)
이전 댓글 표시
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!