how can i specify to take the middle digits of a string?

1 次查看(过去 30 天)
like if i have 426,692,449,089,
i need a variable to assume the value of 692,449,
it could also be 653217,
i would need the value 5321,
??
  2 个评论
Richard
Richard 2012-12-2
First question, are these actually strings or numbers? Secondly what do you mean by middle digits? In the first example you provided you have 12 digits and need the outcome to have 6 digits, then in the second example you have 6 digits and the outcome is 5 digits. Could you please elaborate on your problem.

请先登录,再进行评论。

采纳的回答

Walter Roberson
Walter Roberson 2012-12-2
If it is a string then index it. For example
S = '426,692,449,089,';
S(5:12)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Characters and Strings 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by