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

답변 (1개)

Walter Roberson
Walter Roberson 2018년 6월 20일

0 개 추천

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.

카테고리

도움말 센터File Exchange에서 Numeric Types에 대해 자세히 알아보기

태그

질문:

2018년 6월 20일

답변:

2018년 6월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by