MATLAB: How to retrieve a word from a filename

matlab function

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

Best Answer

name = 'rgb_watermark_lena.jpg';
name(end-7:end-4)
ans =
lena
You probably get the point :)