How to split string with commas to columns?

1 Ansicht (letzte 30 Tage)
Kelly Kyriakou
Kelly Kyriakou am 28 Nov. 2015
Kommentiert: Star Strider am 28 Nov. 2015
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.'

Akzeptierte Antwort

Star Strider
Star Strider am 28 Nov. 2015
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 Kommentare
Kelly Kyriakou
Kelly Kyriakou am 28 Nov. 2015
Thank you very much!
Star Strider
Star Strider am 28 Nov. 2015
As always, my pleasure!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Characters and Strings finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by