hi, i would like to ask how can i do with MATLAB to find the sum values from a unique data.

for example i have the data,

p=[1 1 3 1 2 1 1 1 4 1 1 0.92]

r=[0.1 0.2 0.3 0.3 0.3 0.5 0.6 0.7 0.8 0.8 0.9 0.91]

as we can see there are three 0.3 in set r, and i would like to get the sum value of P ((3+1+2)) where r= 0.3, and the sum value of p ((4+1)) where r=0.8. while for the other P values with the distinctive r value will remain the same.

thanks.