Extract numbers from mixed string.
Show older comments
Str = ['<data seq="0"<temp8.0</temp<data seq="1"<temp6.9</temp'];
I want to extract temp (8.0 & 6.9)
I want to express in workspace
-------------------------------
tem_1 = 8.0
tem_2 = 6.9
-------------------------------
Accepted Answer
More Answers (1)
per isakson
on 29 Oct 2016
Edited: per isakson
on 29 Oct 2016
Use regexp to match strings consisting of (digit,period,digit), and which follow after the string "temp"
Str = ['<data seq="0"<temp8.0</temp<data seq="1"<temp6.9</temp'];
cac = regexp( Str, '(?<=temp)\d\.\d', 'match' );
temp_2 = str2double(cac{2});
temp_1 = str2double(cac{1});
1 Comment
Jeong_evolution
on 3 Nov 2016
Categories
Find more on Characters and Strings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!