Identify maxima value from last row of matrix

1 view (last 30 days)
Poulomi Ganguli
Poulomi Ganguli on 27 Sep 2017
Commented: dpb on 27 Sep 2017
Hello, I have an array element in which first four rows are identical to previous rows in allmost all cases.
Y1 m1 d1 v1 Y2 m2 d2 v2
1970 2 21 0.982 1970 2 25 1030 1030
1970 2 21 0.982 1970 2 26 1030 1030
1971 1 24 0.5612 1971 1 29 356 356
1971 1 24 0.5612 1971 1 30 371 371
1972 8 18 0.3766 1972 8 19 445 445
1972 8 18 0.3766 1972 8 20 441 441
1973 3 2 0.29839 1973 3 7 332 332
1973 3 2 0.29839 1973 3 8 335 335
.................................
.................................
1987 1 5 1.25 1986 12 31 967 967
1987 1 5 1.25 1987 1 3 1060 1060
The first four column shows year, month, day and value. The last four represent another set of year, month, day and value. From the last four column I have to check their day of occurrence. If the event occurs within next three days, I should chose the last four rows with largest value. If they doesn't occur within +/-3 days then keep all rows. The desired output:
1970 2 21 0.982 1970 2 25 1030 1030
1971 1 24 0.561 1971 1 30 371 371
1972 8 18 0.376 1972 8 19 445 445
1973 3 2 0.298 1973 3 8 335 335
1987 1 5 1.25 1987 1 3 1060 1060
Will anybody help me to clean up the matrix following above rule? Thanks
  1 Comment
dpb
dpb on 27 Sep 2017
Well, would give it a shot if could follow the explanation... :)
I'm cornfoozed between 'row' and 'column' here; looks like you've mixed up which you're referring to.
But, first, is "the event occurs within next three days" the time difference between the first set of four on a record or between subsequent records of the first set of times or what, specifically?
Then the "chose [sic] the last four rows with largest value" is that really "rows" or " the row with the larger value of the RH data value (which would be one from the last four columns for the given row)"?

Sign in to comment.

Answers (0)

Categories

Find more on Resizing and Reshaping Matrices in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!