MATLAB: Matlab: Matrix with negative numbers

matrixmatrix arraymatrix manipulation

0
I have a matrix, A = [745 x 678], which consists of negative and positive values. I would like to make all the negative numbers zero but am not sure how to go about doing this.
I was thinking of something like:
n = 678
for i = 1:n
A(A<0) = 0
end
I am not sure to how to apply this to every element of the matrix though. Any help would be appreciated.

Best Answer

No loops needed:
matrix(matrix <0) = 0;