Read data from string
Ältere Kommentare anzeigen
I have string line:
x='abc123(xyz456)'
How to read information only in brackets, to have result:
y='xyz456'.
Akzeptierte Antwort
Weitere Antworten (2)
Azzi Abdelmalek
am 7 Aug. 2013
y=regexp(x,'(?<=\()[\w]+(?=\))','match')
1 Kommentar
Azzi Abdelmalek
am 7 Aug. 2013
%or
x=x='abc123 (xyz 45_6) ddd (rtr)ccc'
y=regexp(x,'\(([\w\s]+)\)','tokens');
celldisp(y)
Jan
am 7 Aug. 2013
x = 'abc123(xyz456)';
ini = strfind(x, '(');
fin = strfind(x, ')');
key = x(ini(1) + 1:fin(1) - 1);
Kategorien
Mehr zu Characters and Strings finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!