MATLAB: Unique changing order(unique output values are reshuffled)

unique

i have cell array with data like '2/6/2009','2/6/2009','2/6/2009','2/6/2009','2/7/2009',,'2/7/2009','2/7/2009','2/8/2009','2/8/2009','2/8/2009'
if i make use of unique to get only unique values the order is getting reshuffled
getting output like : '2/8/2009','2/6/2009','2/7/2009'
Desired output format: '2/6/2009','2/7/2009','2/8/2009'

Best Answer

b={'2/6/2099','2/6/2099','2/6/2099','2/6/2099','2/7/2099','2/7/2099', '2/7/2099','2/8/2099','2/8/2099','2/8/2099','2/10/2099','2/10/2099', '2/12/2099'};
c=datevec(b);
c(:,4:6)=[];
c(:,4)=c(:,1);
c(:,1)=[];
d=num2str(c);
d=cellstr(d);
d=unique(d)
Check this above code. But it's not effective way to do..here In unique(), it's not chosing in random way, it considers the data of first,which is sorted minimum(i.e. '10' is first than '6').