필터 지우기
필터 지우기

how to read numbers in a string where white-space separated everthing

조회 수: 2 (최근 30일)
how to read numbers in a string where white-space separated everything here an example for 2 numbers in a string tab separated: '3 9 8 . 6 1 9 5 0 0 1 3 0 3 1 3 . 2 1 2 7 6 0'
Thanks, Frank
  댓글 수: 2
Jan
Jan 2012년 11월 8일
You forgot to explain what you want as output.
Francois Doucet
Francois Doucet 2012년 11월 8일
>> strrep(S,' ','')
ans =
' 3 9 8 . 6 2 0 0 0 0 ' ' 1 3 0 2 7 1 . 9 9 1 6 0 8 '

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

채택된 답변

Matt Fig
Matt Fig 2012년 11월 8일
편집: Matt Fig 2012년 11월 8일
This is not possible without more information. Say you do this:
S=strrep('3 9 8 . 6 1 9 5 0 0 1 3 0 3 1 3 . 2 1 2 7 6 0',' ','')
% S='398.619500130313.212760'
Should the second number be 313.212760 or 130313.212760 or 3.212760 or any of the other several or so combinations? You need to provide more information to be able to decipher the numbers.
  댓글 수: 14
Matt Fig
Matt Fig 2012년 11월 8일
Glad to help! I am still curious as to how you ended up with char(0) instead of char(32), but I guess we may never know.

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

추가 답변 (0개)

카테고리

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

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by