MATLAB: How to check negative values are there or not in a matrix???

matrixmatrix manipulation

i have a matrix a=[0.2 0.1 -0.1 0 0.9], now i want to check whether there is any negative value if yes then those element i want to make zero.
plz plz help me….
a<0 makes all greater than as 1 and other 0. but i want to make only negative values zero and other as same as they are.

Best Answer

suchismita, use
a(a<0) = 0;