How can i split between strings that connected with under score?
조회 수: 23 (최근 30일)
이전 댓글 표시
" 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
채택된 답변
추가 답변 (1개)
Walter Roberson
2015년 5월 23일
T = regexp(x, '_', 'split');
a = cellfun(@(C) C{1}, T);
b = cellfun(@(C) C{2}, T);
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Numeric Types에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!