how to group rows by date
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Amr Hashem
am 23 Mai 2015
Kommentiert: Amr Hashem
am 24 Aug. 2015
i have this data
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/150455/image.jpeg)
i want to group\sort them to be something like this:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/150456/image.jpeg)
how i can do this ?
0 Kommentare
Akzeptierte Antwort
Andrei Bobrov
am 23 Mai 2015
Bearbeitet: Andrei Bobrov
am 23 Mai 2015
[~,~,z] = xlsread('20150523.xlsx');
c = z(cellfun('isempty',regexp(z,'\')));
[y,~] = datevec(c);
[~,~,c0] = unique(y);
c1 = accumarray(c0,(1:numel(c0))',[],@(ii){c(ii)});
c2 = [c1,repmat({{[]}},size(c1))]';
out = cat(1,c2{1:end-1});
xlswrite('20150523.xlsx',out,1,'B1')
3 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Shifting and Sorting Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!