managing year and months

1 Ansicht (letzte 30 Tage)
Seemab  Janjua
Seemab Janjua am 12 Jun. 2015
Kommentiert: Seemab Janjua am 22 Jun. 2015
i have dataset in following formay M = [2015 1 5 ; 2015 1 6 ; 2015 2 6 ; 2014 3 6 ; ]
split like this A = [2015 1 5 ; 2015 1 6 ; ]
B = [2015 2 6 ;]
C = [2014 3 6 ]

Akzeptierte Antwort

Sean de Wolski
Sean de Wolski am 12 Jun. 2015
doc datetime
Now:
Mdt = datetime(M)

Weitere Antworten (1)

Azzi Abdelmalek
Azzi Abdelmalek am 12 Jun. 2015
Bearbeitet: Azzi Abdelmalek am 12 Jun. 2015
Use cell arrays instead of creating several variables.
M = [2015 1 5 ; 2015 1 6 ; 2015 2 6 ; 2014 3 6 ];
v=M(:,1:2);
[ii,jj,kk]=unique(v,'rows','stable');
out=accumarray(kk,1:numel(kk),[],@(x) {M(x,:)});
celldisp(out);
  1 Kommentar
Seemab  Janjua
Seemab Janjua am 22 Jun. 2015
Thanks Sir Azzi Abdelmalek ...

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Symbolic Math Toolbox 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!

Translated by