Readtable from i-th row to last row
조회 수: 261 (최근 30일)
이전 댓글 표시
Hi,
I am looking for a solution to read an Excel table via readtable from a specific row on down to the last row. I know in which row to start, but I don't know in before which row exactly is the last row.
The only idea I had by now was doing something like
data = readtable(workbookFile, 'sheet', sheetName, 'ReadVariableNames', true, 'FileType', 'spreadsheet', 'UseExcel', false, 'Range', '7:50000');
where 7 ist the row to start the import and 50000 is a valua that high, it would never be reached. The next step would be to delete all the empty rows, that were created (I'm still figuring out how to do it but thats not a part of my question).
That doesn't seem to be very efficient to me. Does anybody have a better solution?
댓글 수: 0
채택된 답변
Jeremy Hughes
2019년 9월 3일
편집: Jeremy Hughes
2022년 7월 7일
Try this
opts = detectImportOptions(filename,'NumHeaderLines',6)
T = readtable(filename,opts)
추가 답변 (1개)
KALYAN ACHARJYA
2019년 9월 2일
편집: KALYAN ACHARJYA
2019년 9월 2일
Readtable from i-th row to last row?
load table, then
or
data=readtable(filename);
i=??? % define
data_read=data(i:end,:)
참고 항목
카테고리
Help Center 및 File Exchange에서 Spreadsheets에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!