How can i split between strings that connected with under score?
11 ビュー (過去 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 で Environment and Settings についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!