can you please tell me how to remove any special characters from a string in MATLAB?
12 次查看(过去 30 天)
显示 更早的评论
special characters include anything else from alphabets(a-z) and(A-Z)
0 个评论
回答(1 个)
Stalin Samuel
2015-5-12
%for example
s='matlab@123'
s(isletter(s)==0)=[];
2 个评论
Walter Roberson
2015-5-12
It is what you defined. isletter() is true only for a-z and A-Z . If you want to leave digits alone then you need to define digits as being not "special characters"
另请参阅
类别
在 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!