From: Chris on 28 Jan 2010 15:56 I am trying to form a vector using the max and min's I want all values smaller than my min to become the min a vice versa with the max. I can single out the min's and max's and even combine them. But I need to take the original vector and make whatever isn't in the max/min range to be the max/min. Any suggestions?
From: Frank on 28 Jan 2010 16:12 A(A<min(A)) = min(A); A(A>max(A)) = max(A);
From: Matt Fig on 28 Jan 2010 16:24 Frank <fbleahy(a)yahoo.com> wrote in message <0842fcba-9682-4315-a9fd-8839d063af2f(a)z26g2000yqm.googlegroups.com>... > A(A<min(A)) = min(A); > A(A>max(A)) = max(A); The left hand side of those expressions is always empty! To the OP: Do you mean this? % Data mymin = 3; % We want nothing less than this mymax = 7; % And nothing larger than this. A = randperm(10) % Engine A = max(A,mymin); A = min(A,mymax)
From: Chris on 28 Jan 2010 16:30 Thank you. That was very helpful.
From: Chris on 28 Jan 2010 16:32
> % Data > mymin = 3; % We want nothing less than this > mymax = 7; % And nothing larger than this. > A = randperm(10) > > % Engine > A = max(A,mymin); > A = min(A,mymax) _____________________________________________________ this one is nicer. I got the other one to work with some manipulation but I think I will try this one too. Thanks. |