how to write a character from a string?
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi I didn't use commands for strings in matlab so i have a word like 'displacement22' and i want to write '22' from this string, so what would i do?
댓글 수: 0
답변 (3개)
Image Analyst
2013년 2월 2일
s = 'displacement22' % Your string.
theNumber = sscanf(s, 'displacement%d') % Extract the number.
댓글 수: 0
Azzi Abdelmalek
2013년 2월 2일
편집: Azzi Abdelmalek
2013년 2월 2일
s='displacement22' ;
out=s(regexp(s ,'[0-9]'))
%or
out=s(regexp(s ,'\d'))
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 String Parsing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!