How to separate string and number?
32 次查看(过去 30 天)
显示 更早的评论
For example convert abcdef[123456], pqrst[456], xyz[99] to
- abcdef | pqrst |xyz
- 123456 |456 |99
1 个评论
回答(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!