MATLAB: Conditional with string wildcard

conditional stringImage Processing Toolbox

Hi all,
I want to use conditional statement to compare the string name using wild card.
image_folder = 'C:\Users';
filenames = dir(fullfile(image_folder, 'Flat.tif'));
total_images = numel(filenames);
full_name = filenames.name;
disp(full_name);
Text1 = 'Tree'*;
Text2 = 'Flat'*;
if strcmp(full_name,Text2)
disp('OK')
else
strcmp(full_name,Text1)
disp('Not OK')
end
But it always comes with the second text "Not OK"
Anyone can help me with that? Thank you in advance

Best Answer

Use startsWith to determine if the file name starts with "Tree" or "Flat".