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!