Store only numbers from user input
Afficher commentaires plus anciens
Hi guys
Is there a way to store only the numbers from lets say an input of the type S^2+67*s+98
Réponse acceptée
Plus de réponses (1)
Jan
le 1 Déc 2011
Another approach from the times of Matlab 5.3 without REGEXP:
S = 'S^2+67*s+98';
S((S < '0' | S > '9') & S ~= '.') = ' ';
N = sscanf(S, '%g');
3 commentaires
Raldi
le 1 Déc 2011
Raldi
le 1 Déc 2011
Walter Roberson
le 1 Déc 2011
Answered in your newer question.
Catégories
En savoir plus sur Data Type Identification dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!