필터 지우기
필터 지우기

Value associate to a parameter in a text

조회 수: 1 (최근 30일)
Jack
Jack 2018년 7월 9일
댓글: Jack 2018년 7월 9일
So I have a text file similar to the following:
DELZZ 3301.23
KUTY 4.32 SERI -0.023
I want Matlab to read the file and return values associate to each parameter (DELZZ, KUTY,SERI,...) Any suggestion?

채택된 답변

Paolo
Paolo 2018년 7월 9일
편집: Paolo 2018년 7월 9일
data = fileread('mytextfile.txt');
val = regexp(data,'(?<=\s)(-?\d*\.?\d*)(?=\s|$)','match');
  댓글 수: 7
Paolo
Paolo 2018년 7월 9일
That's right, you will need to use the greedy * quantifier rather than the + quantifier. Since you need to match those values too, use:
(?<=KUTY01\s)-?\d*\.?\d*
I'll update my answer.
Jack
Jack 2018년 7월 9일
Thank u so much

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by