필터 지우기
필터 지우기

detect nth character in a string

조회 수: 38 (최근 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 CenterFile Exchange에서 String에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by