How to retrieve a word from a filename
显示 更早的评论
name:"rgb_watermark_lena.jpg"
I want to retrieve only "lena" word from file
It should be "lena.jpg"
Can any one sort out this problem
采纳的回答
更多回答(1 个)
Neil Caithness
2012-5-6
It rather depends on how general you want it. Here's another example that may help you decide.
filename = 'rgb_watermark_lena.jpg';
[~, name, ext] = fileparts(filename);
nameparts = regexp(name, '_', 'split');
newfilename = fullfile([nameparts{end} ext])
类别
在 帮助中心 和 File Exchange 中查找有关 Denoising and Compression 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!