How to separate string and number?
26 ビュー (過去 30 日間)
古いコメントを表示
For example convert abcdef[123456], pqrst[456], xyz[99] to
- abcdef | pqrst |xyz
- 123456 |456 |99
1 件のコメント
madhan ravi
2018 年 10 月 13 日
can you edit the code example properly so that people know the exact format?
回答 (2 件)
Star Strider
2018 年 10 月 13 日
str = 'abcdef[123456], pqrst[456], xyz[99]';
out_all= regexp(str, '\w*\d*', 'match');
out_str = out_all(1:2:end)
out_num = out_all(2:2:end)
out_str =
{'abcdef'} {'pqrst'} {'xyz'}
out_num =
{'123456'} {'456'} {'99'}
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Characters and Strings についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!