Removing the first row in data with multiple headers

조회 수: 25 (최근 30일)
Kimmery Migel
Kimmery Migel 2020년 7월 16일
댓글: Kimmery Migel 2020년 7월 17일
I have a text file that has 5 rows of headers. I'm using readtable but I want the second row of headers to be the table headers. How can I remove the first row of the header so readtable uses the second row. I have to do this for about 55 files, and am comfortable making it a loop, I just can't get rid of the first row.
sample file is too large to upload, even wem compressed. It can be found here: https://www.dropbox.com/s/vwc9bucdpyrxarg/s03_lab_base.c3d.txt?dl=0
thanks!
  댓글 수: 2
jonas
jonas 2020년 7월 16일
Upload a sample file
per isakson
per isakson 2020년 7월 16일
See detectImportOptions especially
Location Properties:
DataLines: [2 Inf]
VariableNamesLine: 1

댓글을 달려면 로그인하십시오.

채택된 답변

jonas
jonas 2020년 7월 16일
As per isakson said, use detectimportoptions to fine-tune your table import.
fname = 's03_lab_base.c3d.txt';
opts = detectImportOptions(fname,'VariableNamesLine',2);
T = readtable(fname,opts)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by