detect nth character in a string

80 ビュー (過去 30 日間)
Rusmaya Luthfina
Rusmaya Luthfina 2012 年 1 月 22 日
hello all masters,
i have a variable string for example a = 'c13Maya'
how do i detect the 2nd and 3rd characters of the string ?? the result will give 13 as answer..
any suggestion will be appreciated
thank u,
-Maya-

採用された回答

Dr. Seis
Dr. Seis 2012 年 1 月 22 日
If you want the result to also be a string, then:
b = a(2:3);
If you want the result to be a number, then:
b = str2double(a(2:3));
  4 件のコメント
Rusmaya Luthfina
Rusmaya Luthfina 2012 年 1 月 22 日
it's just fine with string result.. but anyway, thank u for the information u give me Mr. Roberson, it's very useful.. :D
Dr. Seis
Dr. Seis 2012 年 1 月 22 日
edit made

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeString についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by