Store only numbers from user input
Show older comments
Hi guys
Is there a way to store only the numbers from lets say an input of the type S^2+67*s+98
Accepted Answer
More Answers (1)
Jan
on 1 Dec 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 Comments
Raldi
on 1 Dec 2011
Raldi
on 1 Dec 2011
Walter Roberson
on 1 Dec 2011
Answered in your newer question.
Categories
Find more on Data Type Identification in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!