Try this
v = [-4;
2.3;
11];
vLow = [-3;
2;
4.5];
vHigh = [5;
3.5;
8];
v(v<vLow) = vLow(v<vLow);
v(v>vHigh) = vHigh(v>vHigh);
v =
-3.0000
2.3000
8.0000
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!