find/remove 2 consecutive letters from string
显示 更早的评论
Tried the regexp(regexprep) family, still don't know how to get this to work...
I have a cell array of strings, some of which looks like: '.XNY.N'
I simply need to check the cell array, if there is a .N or .M, remove it. Same as in excel you select an array and replace .N and .M with empty.
So in this case '.XNY.N' will be '.XNY'
Anyone knows how to do that? Thanks in advance!
采纳的回答
更多回答(1 个)
Walter Roberson
2012-1-3
Slightly closer to your original question, and using a different regexp pattern:
regexprep('.XNY.N','\.[MN]','')
类别
在 帮助中心 和 File Exchange 中查找有关 Characters and Strings 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!