How to make this string a = '(0 0 0)' into a double b = [0 0 0]?
Afficher commentaires plus anciens
Suppose I don't know what are the number inside the a string, it could be:
a = '(12 2.8 1.22)' % each number is separated by a single space
which should then be:
b = [12 2.8 1.22]
Réponse acceptée
Plus de réponses (1)
Fangjun Jiang
le 5 Août 2022
Modifié(e) : Fangjun Jiang
le 5 Août 2022
a = '(12 2.8 1.22)';
b=sscanf(a,'(%f %f %f)')
b=transpose(sscanf(a,'(%f %f %f)'))
Catégories
En savoir plus sur Characters and Strings dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!