Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

How To Accumulate data by maximizing sum value?

1 Ansicht (letzte 30 Tage)
Pete sherer
Pete sherer am 20 Apr. 2018
Geschlossen: MATLAB Answer Bot am 20 Aug. 2021
Hi, From data below, is there a fast way to identify a block of continuous data that will give largest sum, second largest sum and so on value?
tyear=[1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 3 3 3 3];
tday=[7 10 15 18 20 25 35 50 60 70 150 155 160 250 300 100 200 300 100 105 108 114];
tval=[258008 10000 50553 430195 950000 1800000 924870 214440 423380 255605 578650 12525 786449 440608 576550 519114 956637 773475 227291 134689 238381 510866];
For each given yearID (here 1, 2, 3), I want to group value tval within a specified windows, say 15 days, such that it maximizes the value for all windows. For example year 1
group 1: indx 1:2
group 2: indx 3:6
group 3: indx 7
group 4: indx 8
group 5: indx 9:10
group 6: indx 11:13
group 7: indx 14
group 8: indx 15
For year 2, each group is actually each indx, since the day apart is greater than 15
For year 3, there is only one group with all data in it, since all fall within 15 days.

Antworten (0)

Diese Frage ist geschlossen.

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by