how to remove certain characters from a string in a file
4 次查看(过去 30 天)
显示 更早的评论
how to remove certain characters from a string based on some condition ie i have a text in a file '32/4/5' i want to retain only 32 and delete rest .my condition is if a '/' is identified then rest characters should be deleted .
0 个评论
采纳的回答
Kye Taylor
2012-12-20
编辑:Kye Taylor
2012-12-20
Similar to @Srinivas, you could try
str = '32/4/5';
str = regexprep(str,'/.*','');
更多回答(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!