generate column array with day in year number for each hour in a year
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Dear,
i want a column array with length equal to hours in a year: 365d*24h = 8760
the content of the array should be the number of the day, corresponding with the hours, so:
1,1,1,1,1,..1,2,2...,2,3,3,...,3... - 365,365,...,365. (total length: 8760 values, number 1 should be repeated 24 times, then number 2 repeated 24 times, etc).
How to code this efficiently?
What i tried was a for-loop, but i want to use a more efficient way:
days = zeros(24,1);
all_days = days;
for i = 1:365-1
all_days = [all_days; days+i];
end
0 comentarios
Respuesta aceptada
Más respuestas (1)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!