This is my code and I attached the data file
load 'USS_w3'
USS_w3_POS = USS_w3(USS_w3>0); MEAN = 2.5*mean(USS_w3_POS);
a = 1; for z=1:length(USS_w3)
if USS_w3(a) < MEAN a = a+1; else c = a; while USS_w3(c) > 0 c = c+1; end USS_w3(a:c) = 0; end end
a = 1; for z=1:length(USS_w3)
if USS_w3(a) < MEAN a = a+1; else c = a; while USS_w3(c) > 0 c = c-1; end USS_w3(c:a) = 0; end end