extracting character from a string

28 ビュー (過去 30 日間)
Uwaiz Dhuny
Uwaiz Dhuny 2021 年 3 月 27 日
コメント済み: Uwaiz Dhuny 2021 年 3 月 27 日
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 日
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
  1 件のコメント
Uwaiz Dhuny
Uwaiz Dhuny 2021 年 3 月 27 日
thanks it works

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by