필터 지우기
필터 지우기

How to split string with commas to columns?

조회 수: 15 (최근 30일)
Kelly Kyriakou
Kelly Kyriakou 2015년 11월 28일
댓글: Star Strider 2015년 11월 28일
How to split thsi string to columns with delimiter the comma? '10009_10383,195,1.73936,0.54069,0.579311,56,0,0,0,0,0,0,0,0,0,0,0,0,'
I tried strsplit but I receive the following error 'First input must be a string.'

채택된 답변

Star Strider
Star Strider 2015년 11월 28일
One possibility:
in = '10009_10383,195,1.73936,0.54069,0.579311,56,0,0,0,0,0,0,0,0,0,0,0,0,';
out = regexp(in, ',', 'split');
out = out(1:end-1)
out =
'10009_10383' '195' '1.73936' '0.54069' '0.579311' '56' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0'
Note that ‘out’ is a (1x18) cell.
  댓글 수: 2
Kelly Kyriakou
Kelly Kyriakou 2015년 11월 28일
Thank you very much!
Star Strider
Star Strider 2015년 11월 28일
As always, my pleasure!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by