How can I split a string?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
pamela sulis
am 25 Nov. 2015
Beantwortet: Walter Roberson
am 25 Nov. 2015
Hi, I have this string '0231563972' and i want to split it, put a space between the number: '0 2 3 1 5 6 3 9 7 2'. Can you give me suggestions?
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 25 Nov. 2015
S = '0231563972';
newS = regexprep(S, '(.)(?=.)', '$1 ');
or
newS = strjoin(num2cell(S),' ');
0 Kommentare
Weitere Antworten (0)
Siehe auch
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!