MATLAB: Find a string from a cell array

cell arrays

I have a cell array of dates as
'Mon 22-08-2016'
'Mon 22-08-2016'
'Mon 22-08-2016'
'Tue 23-08-2016'
'Tue 23-08-2016'
'Tue 23-08-2016'
'Tue 23-08-2016'
if i enter a date as, '23-08-2016', i want to get the first row with that date….

Best Answer

a = {'Mon 22-08-2016'
'Mon 22-08-2016'
'Mon 22-08-2016'
'Tue 23-08-2016'
'Tue 23-08-2016'
'Tue 23-08-2016'
'Tue 23-08-2016'}
idx = find(cellfun(@(x) ~isempty(x),strfind(a,'23-08-2016')),1,'first')