MATLAB: Check for a word

check for a word

I need to check if the current folder name contains words: YES or DYES.
such that:
if it contains YES:
a=1
if it contains DYES:
a=2
code I'm starting with:
Folder=pwd;
[PathStr,FolderName]=fileparts(Folder);

Best Answer

if strfind(FolderName, 'YES'); a = 1; end
if strfind(FolderName, 'DYES'); a = 2; end
What if the folder name contains both? Or neither? What if the folder name contains the word but in lower case?