How can i sum a time array
Mostrar comentarios más antiguos
I want to sum a time array which in seconds like 600 sec but i want to make it in minutes. on the other hand i have another array time difference that have 178 components. I want to make those time difference in minutes. So, I want to convert those time differences array in per minutes. So, I need 10 points or components for 600 SECONDS . here is the code that i have tried but can not work, tdif is the time difference array.
t=0;
i=1;
A=0;
for j=60:60:600;
A=i+A;
for i=i:1:length(tdif);
t = t + tdif(1,i);
if t>=j;
break
end
end
Respuestas (1)
Walter Roberson
el 20 de Jun. de 2018
0 votos
The easiest way is to convert to timetable() objects and use retime()
If your times are at regular intervals, then you could reshape() or buffer() to get them into groups that you could then sum() or mean() as needed.
Categorías
Más información sobre Numeric Types en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!