How to skip last n rows while reading a csv file using readtable?
조회 수: 46 (최근 30일)
이전 댓글 표시
I have a csv file that I want to read as table in MATLAB using readtable command. However, I know that last few lines are corrupted or not reliable and I want to skip them. How can I do that using readtable. Note that a similar function is available in python's panda package for read.csv by supplying skipfooter.
댓글 수: 0
채택된 답변
Rahul Bhadani
2021년 2월 16일
댓글 수: 1
Venkatkumar M
2022년 11월 22일
How to skip first 20 rows in the csv file?
Could you please give some answer?
추가 답변 (1개)
KALYAN ACHARJYA
2021년 2월 16일
편집: KALYAN ACHARJYA
2021년 2월 16일
This way?
data_table=readtable('filename');
%want to remove n rows from last
n=;...?
data=data_table(1:end-n,:)
댓글 수: 4
Venkatkumar M
2022년 11월 22일
How to skip first 20 rows in the csv file?
Could you please give some answer?
Walter Roberson
2022년 11월 22일
data_table = readtable('filenameGoesHere', 'HeaderLines', 20);
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!