Read data from string
显示 更早的评论
I have string line:
x='abc123(xyz456)'
How to read information only in brackets, to have result:
y='xyz456'.
采纳的回答
更多回答(2 个)
Azzi Abdelmalek
2013-8-7
y=regexp(x,'(?<=\()[\w]+(?=\))','match')
1 个评论
Azzi Abdelmalek
2013-8-7
%or
x=x='abc123 (xyz 45_6) ddd (rtr)ccc'
y=regexp(x,'\(([\w\s]+)\)','tokens');
celldisp(y)
Jan
2013-8-7
x = 'abc123(xyz456)';
ini = strfind(x, '(');
fin = strfind(x, ')');
key = x(ini(1) + 1:fin(1) - 1);
类别
在 帮助中心 和 File Exchange 中查找有关 Characters and Strings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!