MATLAB: Sorting columns with empty cells

sorting

Dear all,'
I have the following column and as you can see the 1rst, 40th, 79th asnd so forth are mising
''
'23-11-2008'
'21-12-2008'
'18-01-2009'
'15-02-2009'
'15-03-2009'
'12-04-2009'
'10-05-2009'
'07-06-2009'
'05-07-2009'
'02-08-2009'
'30-08-2009'
'27-09-2009'
'25-10-2009'
'22-11-2009'
'20-12-2009'
'24-01-2010'
'21-02-2010'
'21-03-2010'
'18-04-2010'
'16-05-2010'
'13-06-2010'
'11-07-2010'
'08-08-2010'
'05-09-2010'
'03-10-2010'
'31-10-2010'
'28-11-2010'
'26-12-2010'
'23-01-2011'
'20-02-2011'
'20-03-2011'
'17-04-2011'
'15-05-2011'
'12-06-2011'
'12-07-2011'
'07-08-2011'
'04-09-2011'
'02-10-2011'
''
'23-11-2008'
'21-12-2008'
'18-01-2009'
'15-02-2009'
'15-03-2009'
'12-04-2009'
'10-05-2009'
'07-06-2009'
'05-07-2009'
'02-08-2009'
'30-08-2009'
'27-09-2009'
'25-10-2009'
'22-11-2009'
'20-12-2009'
'24-01-2010'
'21-02-2010'
'21-03-2010'
'18-04-2010'
'16-05-2010'
'13-06-2010'
'11-07-2010'
'08-08-2010'
'05-09-2010'
'03-10-2010'
'31-10-2010'
'28-11-2010'
'26-12-2010'
'23-01-2011'
'20-02-2011'
'20-03-2011'
'17-04-2011'
'15-05-2011'
'12-06-2011'
'12-07-2011'
'07-08-2011'
'04-09-2011'
'02-10-2011'
''
'23-11-2008'
I want to sort out a bigger matrix say mdata1 using the code
d=datenum(mdata1(:,11),'dd-mm-yyyy');
[l,idx]=sortrows(d);
zoi=mdata1(idx,:);
where mdata1(:,11), is the above column
the problem is that some cells are empty as i said before
and the matlab stucks at command datenu
Is there anything I can to avoid this problem withou creating a fake date for the empty cells?
thanks in advance

Best Answer

d1 = mdata1(:,11);
d1(cellfun('isempty',d1)) = {'00-00-0000'};
[id,id] = sort(datenum(d1,'dd-mm-yyyy'));
out = mdata1(id,11);