필터 지우기
필터 지우기

Character Restrictions in a Text File

조회 수: 3 (최근 30일)
jgillis16
jgillis16 2015년 10월 18일
댓글: jgillis16 2015년 10월 19일
I am trying to restrict the 25th column of this text file by exporting entire line either of the following characters, "Ib, Ib/c, Ic, IIb, II, IIP, IIn, IIPec". How would I go about doing this?
I have attached my text file as a reference.

답변 (1개)

Walter Roberson
Walter Roberson 2015년 10월 19일
contents = fileread('observedsn.txt');
[starts, stops] = regexp(contents, '^([^|]*\|){24}(Ib|Ib/c|Ic|II|IIP|IIn|IIPec)\|.*$', 'start', 'end', 'lineanchors', 'dotexceptnewline');
Now the relevant lines are at contents(starts(K):stops(K)) for K = 1 : length(starts)
  댓글 수: 1
jgillis16
jgillis16 2015년 10월 19일
How would I then export these restricted lines to a new text file?

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by