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

4 views (last 30 days)
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?

Accepted Answer

Star Strider
Star Strider on 14 Mar 2018
Try this:
A(A > 1E+20) = NaN;

More Answers (0)

Tags

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!