How to separate string and number?
32 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
For example convert abcdef[123456], pqrst[456], xyz[99] to
- abcdef | pqrst |xyz
- 123456 |456 |99
1 commentaire
madhan ravi
le 13 Oct 2018
can you edit the code example properly so that people know the exact format?
Réponses (2)
Star Strider
le 13 Oct 2018
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 commentaires
Voir également
Catégories
En savoir plus sur Characters and Strings dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!