How can i split between strings that connected with under score?
Mostrar comentarios más antiguos
" 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.
Respuesta aceptada
Más respuestas (1)
Walter Roberson
el 23 de Mayo de 2015
T = regexp(x, '_', 'split');
a = cellfun(@(C) C{1}, T);
b = cellfun(@(C) C{2}, T);
Categorías
Más información sobre String Parsing en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!