MATLAB: Char array comparison

char comparision

I have a large char array and these are dates so the array has elements as: 20070801 20070802 20070803 etc.
This array shows up as 100×8 in the workspace. I want to get all the dates which are less than 20070915. How do I use the 'find' function to achieve this or any other straight forward method?

Best Answer

a=['20070801';'20070802';'20070803']; %some date values
b=20070802; %value to compare
a(find(str2num(a)<b),:) %date values older than the compared value