Hello all, I need to extract numbers from char. For exp
("Acb2hea" == 10)
("Acb2hea1" >= 15)
("Acb2hea" <= 20)
I used regular expression but unble to get exact value which I want as below. I am getting like. 2 10 2 1 15 2 20
But Need output like 10 15 20

 채택된 답변

Stephen23
Stephen23 2020년 10월 1일
편집: Stephen23 2020년 10월 1일

0 개 추천

>> regexp('("Acb2hea" == 10)','\<\d+\>','match')
ans =
'10'
>> regexp('("Acb2hea1" >= 15)','\<\d+\>','match')
ans =
'15'
>> regexp('("Acb2hea" <= 20)','\<\d+\>','match')
ans =
'20'
If required use str2double to convert to numeric.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Language Support에 대해 자세히 알아보기

질문:

2020년 10월 1일

댓글:

2020년 10월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by