MATLAB: Replace ‘greater than’ values in a matrix

greater thanmatrixreplace

I want to look through a very large matrix and replace numbers that are larger than, say, a, with b.
Is there a simple way or a function to do this?

Best Answer

M - your matrix
M(M > a) = b;