managing year and months

1 次查看(过去 30 天)
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 ]

采纳的回答

Sean de Wolski
Sean de Wolski 2015-6-12
doc datetime
Now:
Mdt = datetime(M)

更多回答(1 个)

Azzi Abdelmalek
Azzi Abdelmalek 2015-6-12
编辑:Azzi Abdelmalek 2015-6-12
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);

类别

Help CenterFile Exchange 中查找有关 Parallel Computing 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by