I have following matrix in which first, second, third column show year, month, day and value from event 1. However, some of the days are consecutive. I need to choose only those days in a year which contains maximum value in column 3 out of consecutive occurrences.
1970 1 13 0.4659 1970 1 18 29.851970 1 14 0.4423 1970 1 18 29.851971 1 21 0.5851 1971 1 26 25.631971 1 23 0.4701 1971 1 26 25.631971 3 18 0.4938 1971 3 19 15.481972 2 2 0.4272 1972 2 2 35.331972 8 8 0.3888 1972 8 7 7.5211972 12 27 0.5758 1972 12 28 25.251973 12 19 0.5834 1973 12 19 25.971973 12 20 0.5414 1973 12 19 25.971973 12 23 0.5011 1973 12 19 25.971974 1 27 0.4437 1974 1 30 51.961974 2 11 0.5594 1974 2 11 45.361974 9 2 0.49 1974 9 5 23.041975 1 14 0.4255 1975 1 19 17.991975 1 15 0.4486 1975 1 19 17.991975 9 27 0.381 1975 9 25 5.8251976 10 11 0.3337 1976 10 14 25.121976 12 6 0.3528 1976 11 30 25.931977 3 15 0.4784 1977 3 15 15.41977 10 8 0.43136 1977 10 6 3.3251977 12 8 0.4412 1977 12 9 24.11978 2 19 0.43 1978 2 25 22.381978 2 25 0.4208 1978 2 25 22.381978 12 23 0.3763 1978 12 23 24.881979 1 3 0.5779 1978 12 28 20.261979 2 8 0.4116 1979 2 7 15.011979 12 15 0.411 1979 12 15 21.241980 3 26 0.47822 1980 3 31 22.51980 3 27 0.436 1980 3 31 22.5
The desired output matrix is:
1971 1 13 0.46 1970 1 18 29.851971 1 21 0.58 1971 1 26 25.631971 3 18 0.49 1971 3 19 15.481972 2 2 0.42 1972 2 2 35.331972 8 8 0.38 1972 8 7 7.5211972 12 27 0.57 1972 12 28 25.251973 12 19 0.58 1973 12 19 25.971973 12 23 0.50 1973 12 19 25.971974 1 27 0.44 1974 1 30 51.961974 2 11 0.55 1974 2 11 45.36
The associated .mat file is also attached.
Best Answer