Matlab - verify if a string have any number
Show older comments
hi everyone;
I have a string and i need to verify if there are any number.
for example
str='scramble3'
and i need a answer like, True or 1(to yes) and False or 0(to no)
Thanks
Accepted Answer
More Answers (1)
Azzi Abdelmalek
on 7 Aug 2014
Edited: Azzi Abdelmalek
on 7 Aug 2014
str='scramble3'
idx=~isempty(regexp(str,'\d','match'))
%or
idx=any(ismember(str,'0':'9'))
Categories
Find more on Characters and Strings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!