how can i specify to take the middle digits of a string?
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Richard
il 2 Dic 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.
Risposta accettata
Walter Roberson
il 2 Dic 2012
If it is a string then index it. For example
S = '426,692,449,089,';
S(5:12)
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Characters and Strings in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!