extracting character from a string
조회 수: 33 (최근 30일)
이전 댓글 표시
hi,
i want to know how to extract a character from a string, for example if my string is MATLABQUESTION, i want the fifth letter only.
댓글 수: 0
채택된 답변
DGM
2021년 3월 27일
If you only want the n-th character, then it's simple:
mystring='MATLABQUESTION';
fifthchar=mystring(5)
which would be:
fifthchar =
A
And of course, you could do a range:
substring=mystring(7:11)
to get
substring =
QUEST
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Characters and Strings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!