How do I make this mask statement more concise?
1 次查看(过去 30 天)
显示 更早的评论
I have a problem where I need to remove all numerical characters from a string. I currently have it like this:
message = message(message != '0')
message = message(message != '1')
and so on
I want to condense these into a single statement, but I'm having trouble figuring out how to. How would I go about making this more concise?
0 个评论
采纳的回答
Image Analyst
2017-12-4
Here's one way:
message = 'abc0123456def7890ghi'
message(message >= '0' & message <= '9') = []
0 个评论
更多回答(1 个)
另请参阅
类别
在 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!