필터 지우기
필터 지우기

how to split these char format into lines

조회 수: 3 (최근 30일)
Yu Li
Yu Li 2020년 7월 17일
댓글: Yu Li 2020년 7월 17일
I have a char format data which is read from the last several lines of a file, from Linux system, by command provide by this answer:
however, I failed to find the way to split them into lines, I tried 'split' function with different deliminter such as '/t','/n', etc., but all failed.
could anyone give me some suggestions? please see attahce file.
Thanks!
Yu

채택된 답변

Sindar
Sindar 2020년 7월 17일
편집: Sindar 2020년 7월 17일
ed: Matlab has a built-in function
w_split = splitlines(w);
Here's a trick: I don't know what the delimiter between lines is, but I know where it is (with a little scanning), so I can extract it.
tmp=w(117)
tmp =
'
'
w_split = split(w,tmp);

추가 답변 (1개)

Walter Roberson
Walter Roberson 2020년 7월 17일
regexp(w, '\r?\n', 'split')

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by