How to separate numbers and text from a string
7 次查看(过去 30 天)
显示 更早的评论
Hello,
i have string variable s = 'x 5.67 y 7.789';
i would like to read only numbers from the string.
requesting you to help me, how to separate numbers and text from the string.
Thanks & Regards Venkatapathi.P
0 个评论
采纳的回答
Azzi Abdelmalek
2014-1-28
编辑:Azzi Abdelmalek
2014-1-28
s = 'x 5.67 y 7.789'
out=str2double(regexp(s,'[\d.]+','match'))
4 个评论
Bhupinder Saini
2018-9-5
How do you alter this to return the characters only in the string?
i.e. x.h y g j
Nader Virk
2022-2-25
For string s, I appreciate if someone could help how to get only the chracters? Thanks!
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Characters and Strings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!