tags:

views:

53

answers:

1

How can I set the values in x that are above the mean to their difference from the mean.

x = [3 15 9 12 -1 0 -12 9 6 1]
+5  A: 
x = [3 15 9 12 -1 0 -12 9 6 1];
m = mean(x);
idx = (x>m);
x(idx) = x(idx) - m;
Amro
Thanks Amro .. you are a lifesaver.. Shokran!!
Jack Lu

related questions