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!