Know When to Use isequal()
Cephas
on 12 Nov 2025
Latest activity Reply by Christian Schröder
on 12 Nov 2025
isequal() is your best friend for Cody! It compares arrays perfectly without rounding errors — much safer than == for matrix outputs.
1 Comment
Time DescendingBut keep in mind two things:
- Two NaNs are not usually considered equal. If you want this to be the case, use isequaln() instead.
- isequal(), like ==, may give counterintuitive results for floating-point numbers (isequal(0.1+0.2,0.3) is 0). Depending on your use case you may want isapprox() instead.
Sign in to participate