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

2 views (last 30 days)
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 Comments
Richard
Richard on 2 Dec 2012
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.

Sign in to comment.

Accepted Answer

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

More Answers (0)

Community Treasure Hunt

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

Start Hunting!