convert text like '(18)' to number

1 次查看(过去 30 天)
Stewart Smith
Stewart Smith 2019-11-8
is there simple way to extract this text and convert to number?

回答(1 个)

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

类别

Help CenterFile Exchange 中查找有关 Text Data Preparation 的更多信息

标签

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by