Sum in Matrix with condition
1 次查看(过去 30 天)
显示 更早的评论
Hi! I have the following issue: I have a big matrix, for example 1000x12. The values in one row are 5-min-precipitation-measurements (12*5 min= 1 hour).I have to build a sum of the measurement values>0, under the condition that there are at least 3 hours difference between the end of one and the beginning of the next precipitation event. If the difference between sums is less than 3 hours, the sums should be put together in one. The Date and Hour are saved in a separate vector.
Example for Precipitation matrix:
1 0 1 0 26 32 41 41 47 50 44 36
0 0 0 0 0 1 0 0 0 0 10 10
0 0 1 4 7 8 7 7 4 1 0 0
0 0 7 5 2 1 0 0 0 0 13 14
5 6 5 4 0 0 0 0 2 1 2 0
0 0 0 0 0 0 0 0 0 0 4 1
0 0 0 0 0 0 1 0 2 3 5 3
0 0 0 0 0 0 0 2 0 0 0 0
0 0 6 5 2 5 1 2 0 0 6 6
0 0 0 0 0 0 2 1 0 0 0 0
0 0 0 0 0 0 35 39 49 50 49 129
50 194 708 832 150 103 49 49 40 25 17 36
49 50 214 328 311 215 104 104 153 139 127 105
49 50 49 50 49 50 49 40 35 29 18 24
23 13 1 1 4 16 46 50 49 50 49 50
.
.
.
Example for Date Vector:
'20-Jan-1965 14:00:00'
'20-Jan-1965 16:00:00'
'20-Jan-1965 17:00:00'
'20-Jan-1965 18:00:00'
'20-Jan-1965 20:00:00'
'20-Jan-1965 21:00:00'
'20-Jan-1965 23:00:00'
'21-Jan-1965 00:00:00'
'21-Jan-1965 01:00:00'
'21-Jan-1965 02:00:00'
'21-Jan-1965 04:00:00'
'21-Jan-1965 05:00:00'
'21-Jan-1965 06:00:00'
'21-Jan-1965 07:00:00'
'21-Jan-1965 08:00:00'
.
.
.
Can someone help? Thanks!!
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Dates and Time 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!