필터 지우기
필터 지우기

how to remove header row

조회 수: 93 (최근 30일)
Samaneh Arzpeima
Samaneh Arzpeima 2019년 1월 9일
댓글: Samaneh Arzpeima 2019년 1월 9일
Hi
I have a file and need to extract lines with specific names, namely rows that their forth colomns are str*dep01
So I used data inport tool to read it into a table
writetable(FAULTSTATIONS,'FAULTSTATIONS.txt','Delimiter',' ','WriteRowNames',true)
type 'FAULTSTATIONS.txt'
then I got
VarName1 VarName2 VarName3 VarName4 VarName5
-150000 -100000 0 "str01dep01" 1
-132765.8649 -100000 -3038.843 "str01dep02" 1
-103221.6342 -100000 -8248.288 "str01dep03" 1
-73677.42052 -100000 -13457.73 "str01dep04" 1
-14588.95908 -100000 -23876.62 "str01dep05" 1
I need to remove the header first (VarName1........VarName5) and use something like
filename = 'FAULTSTATION.txt';
? = importdata(filename);
I am sorry I have no idea what to do,would you please tell me what to do

답변 (1개)

madhan ravi
madhan ravi 2019년 1월 9일
편집: madhan ravi 2019년 1월 9일
t=readtable('FAULTSTATIONS.txt'); % tables by default have variable names so covert to cell
table2cell(t)
  댓글 수: 1
Samaneh Arzpeima
Samaneh Arzpeima 2019년 1월 9일
thank you,I've got a cell without the header row. not sure how to extract what i need.
I wanted to import the original file to text file, delete the first line and save the remaining lines to a new text file. Then extract those rows which their 4th colomns match with
str * dep01

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

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by