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

 採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2014 年 7 月 18 日

0 投票

string='de orvalho: 16° C</li'
out=str2double(regexp(string,'\d+','match'))

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeCharacters and Strings についてさらに検索

質問済み:

2014 年 7 月 18 日

回答済み:

2014 年 7 月 18 日

Community Treasure Hunt

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

Start Hunting!

Translated by