How to count how many numbers there are in a string?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Respuesta aceptada
Star Strider
el 11 de En. de 2015
This works:
n = length(strsplit(st(~isletter(st))))-1;
0 comentarios
Más respuestas (1)
Azzi Abdelmalek
el 11 de En. de 2015
str='a b c 45 3 2'
out=numel(regexp(str,'\d+','match'))
3 comentarios
Ced
el 20 de En. de 2015
That's because these are the only two functions there. You can find a list and description of the different input arguments of e.g. regexp in the documentation: Regexp Documentation
Ver también
Categorías
Más información sobre Characters and Strings en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!