Skip to main content
. 2021 Mar 26;4:415. doi: 10.1038/s42003-021-01937-1
For i = 1 : k
 Count the length of the noisy segment as num
 IF num==i
   Count the length of the segments with a consecutive same value at both ends of this noisy segment as j_left and j_right
   IF (j_left >= i and j_right>= i+1) or (j_right >=i and j_left >= i+1)
     Correct the value of noisy segment to the corresponding value of its left and right segments
Here: k = 6, and the result after the current (i-th) correction is the starting data for the next (i+1-th) correction.