How can I separate individual years from a timetable?
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Ashfaq Ahmed
el 6 de Mzo. de 2023
Comentada: Stephen23
el 7 de Mzo. de 2023
Hi!
I have one table that contains 764 rows with different year's data point from 1984 to 2022. For example, row 1 to 8 are for 1984, row 9 to 14 are for 1985, row 15 to 24 are for 1986 and so on.
Can anyone please tell me how to create a cell array where I can have the indices for the individual year?
i.e., {year_list} = {[1:8];[9:14];[15:24],....} etc.
I have added the table in this question. Any feedback will be greatly appreciated!!
0 comentarios
Respuesta aceptada
Stephen23
el 6 de Mzo. de 2023
Editada: Stephen23
el 6 de Mzo. de 2023
S = load('DateStamp.mat')
T = S.DateStamp
[G,Y] = findgroups(T.date.Year);
X = arrayfun(@(x)find(x==G), 1:max(G), 'uni',0);
These are the years:
Y
and the corresponding indices:
X
X{1:3}
See also:
4 comentarios
Stephen23
el 7 de Mzo. de 2023
S = load('DateStamp.mat');
T = S.DateStamp
[G,Y] = findgroups(T.date.Year);
N = accumarray(G,ones(size(G)));
bar(Y,N)
Más respuestas (0)
Ver también
Categorías
Más información sobre Logical en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!