How can i split between strings that connected with under score?
22 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
ben velt
am 23 Mai 2015
Beantwortet: Walter Roberson
am 23 Mai 2015
" x= 'Penelope_Cruz' 'Gary_Cooper' 'Tony_Curtis' 'Jim_Carrey'"
I want to split x into two different variables, like this:
a= 'Penelope' 'Gary' 'Tony' 'Jim'
b= 'Cruz' 'Cooper' 'Curtis' 'Carrey'
I want to do it for unknown amount of names.
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (1)
Walter Roberson
am 23 Mai 2015
T = regexp(x, '_', 'split');
a = cellfun(@(C) C{1}, T);
b = cellfun(@(C) C{2}, T);
0 Kommentare
Siehe auch
Kategorien
Mehr zu Numeric Types 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!