I need to separate text from value
이전 댓글 표시
I need to separate the output of fscanf
current_amp =
:MEASUREMENT:IMMED:VALUE 35.0E-12
and only retain the number.
I would like to have the output only give me 35.0E-12.
I looked into using regexp, but it also separates the number to 35 12.
If anyone has any advice it would be greatly appreciated.
Best
Umar
답변 (1개)
Jos (10584)
2016년 3월 1일
str = ':MEASUREMENT:IMMED:VALUE 35.0E-12'
value = sscanf(str,'%*s %f')
댓글 수: 4
Jos (10584)
2016년 3월 1일
or perhaps you can use fscanf directly using the file identifier:
value = fscanf(fid,'%*s %f')
Umar Twahir
2016년 3월 1일
편집: Walter Roberson
2016년 3월 2일
Umar Twahir
2016년 3월 1일
Jos (10584)
2016년 3월 1일
Good to hear that. Solving a problem yourself is the best way to learn!
카테고리
도움말 센터 및 File Exchange에서 Text Files에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!