MATLAB: Manipulation of seperate vector values

manipulation

so i have a vector set of values and wanted to round all the values to the nearest positive, even integer. and all the values less then zero are rounded to zero. any idea on how to do this using an mfile?

Best Answer

v(v<0) = 0;
v = round(v/2) * 2;