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.

 채택된 답변

DGM
DGM 2021년 3월 27일

0 개 추천

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개)

카테고리

도움말 센터File Exchange에서 Characters and Strings에 대해 자세히 알아보기

제품

릴리스

R2020b

질문:

2021년 3월 27일

댓글:

2021년 3월 27일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by