Read data from string
Show older comments
I have string line:
x='abc123(xyz456)'
How to read information only in brackets, to have result:
y='xyz456'.
Accepted Answer
More Answers (2)
Azzi Abdelmalek
on 7 Aug 2013
y=regexp(x,'(?<=\()[\w]+(?=\))','match')
1 Comment
Azzi Abdelmalek
on 7 Aug 2013
%or
x=x='abc123 (xyz 45_6) ddd (rtr)ccc'
y=regexp(x,'\(([\w\s]+)\)','tokens');
celldisp(y)
Jan
on 7 Aug 2013
x = 'abc123(xyz456)';
ini = strfind(x, '(');
fin = strfind(x, ')');
key = x(ini(1) + 1:fin(1) - 1);
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!