How to make this string a = '(0 0 0)' into a double b = [0 0 0]?
Mostra commenti meno recenti
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]
Risposta accettata
Più risposte (1)
Fangjun Jiang
il 5 Ago 2022
Modificato: Fangjun Jiang
il 5 Ago 2022
a = '(12 2.8 1.22)';
b=sscanf(a,'(%f %f %f)')
b=transpose(sscanf(a,'(%f %f %f)'))
Categorie
Scopri di più su Characters and Strings in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!