MATLAB: Recognize Number/Special Characters

MATLABstrings

Hi,
I have below input string and from it I want to recognize digits/special characters, May be some flag can be set
txt='har23#$'
Like if alphabet then flag=1 and for digits/Special Characters flag=0
Pls provide me some direction..
Thanks in Advance..

Best Answer

txtisalpha = ismember(txt, ['a':'z', 'A':'Z']);
Then txtisalpha will be a vector with true for English letters and false for other characters (including spaces).