Store only numbers from user input
显示 更早的评论
Hi guys
Is there a way to store only the numbers from lets say an input of the type S^2+67*s+98
采纳的回答
更多回答(1 个)
Jan
2011-12-1
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');
类别
在 帮助中心 和 File Exchange 中查找有关 Data Type Identification 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!