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
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!