How to extract a number from a string

I have this string:
" <li>Ponto de orvalho: 16&#176; C</li>"
and I want to extract the number 16, but this number can change.
I was doing this: Torvalhoactual=str2num([tline(57),tline(58)]);
but since the number can change to 1 digital number this code crashes

 Respuesta aceptada

Azzi Abdelmalek
Azzi Abdelmalek el 18 de Jul. de 2014
string='de orvalho: 16° C</li'
out=str2double(regexp(string,'\d+','match'))

Más respuestas (0)

Categorías

Más información sobre Characters and Strings en Centro de ayuda y File Exchange.

Preguntada:

el 18 de Jul. de 2014

Respondida:

el 18 de Jul. de 2014

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by