How can i sum a time array
古いコメントを表示
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
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 についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!