MATLAB: Check filename of the input image

check filename of input image

I wanna make sure the filename of input image is same as what I want. I need it to get into if-else statement.
For example(some sort like this):
a = imread('img.jpg');
if(image_wanted == img.jpg) for(k =1:5) x(k) = k; end end

Best Answer

use strcmpi:
if strcmpi(image_wanted, 'img.jpg')
% Name matches
else
% Name does not match.
end