How can i scale certain values in a vector?
Show older comments
I have a certain vector with data and now i want to scale all values below 0 to values between -1 and 0 and all values above 0 i want to scale to values between 1 and 0.
So i have a vector A All the values below 0 (<0) i want to devide by a certain value all the values above 0 (>0) i want to devide to another certain value all the values which are 0 should stay 0.
Is this possible to do with matlab?
Accepted Answer
More Answers (1)
dpb
on 26 Mar 2015
ix=x>0; % logical vector +ive loc's
x(ix)=x(ix)/max(x(ix)); % normalize +ive
x(~ix)=x(~ix)/max(abs(x(~ix))); % normalize -ive
Categories
Find more on MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!