How to split string with commas to columns?

15 次查看(过去 30 天)
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.

更多回答(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