MATLAB: Sorting cell array by date cell arraydatesort Hi everybody, i have cell array, which includes a specific column with dates (dd.mm.yyyy_HH:mm:ss). I want to sort the whole array by this dates. Can anybody help me out? Matlab R2016a Best Answer Your data are already sorted:D = load('sort-by-2nd-column.mat');Data = D.GivenData;[dn,idx] = sort(datenum(Data(2:end,2), 'dd.mm.yyyy_hh:MM:ss'), 1, 'ascend');There is nothing to do.[EDITED, copied from comment]% First Row Are Column LabelsData = D.GivenData(2:end,:);% First Output Of ‘sort’ Not Necessary, So Not Returned[~,idx] = sort(datenum(Data(:,2), 'dd.mm.yyyy_hh:MM:ss'), 1, 'ascend');Data_Sorted = Data(idx,:); Related SolutionsMATLAB: How can i forecast by neural network tool yr/mo/day is constant. Therefore ignore Measure time in hours or minutes from midnight help fitnet doc fitnetHope this helps.Greg MATLAB: I want to use fonction(unique) to get un string ,but it awlays shows Error using cell/unique?Can anyone tell me what I am doing wrong here? thank you pengcheng, use P = [pa(1),pa(2),pa(3),pa(4),pa(5)]; H = unique(P);instead. Related QuestionDatetick error message when displaying dates on the x-axis
Best Answer