MATLAB: I want add a value to every element that is less than zero in the vector.

vector

i.e. i have a vector to which want to add 180 to all negative values. any help ??

Best Answer

myVec( myVec < 0 ) = myVec( myVec < 0 ) + 180;