MATLAB: How to set all elements of a matrix that meet a certain criteria to NaN

findMATLAB

I have a Matrix A with the size of [200 100 20 60]. How do I set all elements larger than 10^20 as NaN?

Best Answer

Try this:
A(A > 1E+20) = NaN;