MATLAB: How to extract Jan and feb dates from an array of date strings

MATLAB

Hi,
I have an array of cells of date string. I need to extract all the dates in Jan and Feb. How to do that? Thanks a lot!

Best Answer

>> C = {'1/1/2018'; '2/1/2018'; '12/31/2018'};
>> X = cellfun('isempty',regexp(C,'^[12]/','once'));
>> D = C(~X)