convert text like '(18)' to number

is there simple way to extract this text and convert to number?

Answers (1)

S = '(18)';
value = sscanf(S, '(%f' )
You can get more complicated, like,
S = '(18,-3.8)';
value = sscanf(S, '(%f,%f)');

Categories

Products

Release

R2019b

Asked:

on 8 Nov 2019

Answered:

on 8 Nov 2019

Community Treasure Hunt

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

Start Hunting!