Clear Filters
Clear Filters

how catch number in "()"

2 views (last 30 days)
piero
piero on 19 Sep 2023
Edited: Voss on 19 Sep 2023
f={"1A(12)","cB(34)","4C(23)"}
i want catch array with 12 34 and 23

Accepted Answer

Voss
Voss on 19 Sep 2023
Edited: Voss on 19 Sep 2023
f={"1A(12)","cB(34)","4C(23)"};
C = regexp(cellstr(f),'\((.*)\)','tokens','once');
C = [C{:}]
C = 1×3 cell array
{'12'} {'34'} {'23'}
N = str2double(C)
N = 1×3
12 34 23

More Answers (0)

Categories

Find more on Operators and Elementary Operations 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!