MATLAB: Detecting the existence of alphabetical elements

regular expressionsstring parsing

Dear all, I would like to detect whether a string contains an alphabetical letter. A simple way of solving this problem is writing a function such as. But is there any better, more concise and faster way? Can one use, say, regular expressions and if so how?
thanks, Pat.
function flag=detect_alphabet(mystring)
referenceSet={'a','b','c','d',...,'z'};
flag=false;
for ii=1:length(mystring)
if ismember(mystring(ii),referenceSet)
flag=true;
break
end
end

Best Answer

Perhaps best of all:
str = 'adsf2342adsfwerreoj9f3f';
str2 = '23423';
flag = any(isletter(str))
flag = any(isletter(str2))