Using isempty
on a logical expression creates incorrect
results.
To determine if all the conditions are false, use ~any(...)
or ~any(..., "all")
for matrices instead. For example:
Old | Replacement | Replacement For Matrices |
---|---|---|
isempty(x == y)
|
~any(x == y)
|
~any(x == y, "all")
|
isempty(x ~= y)
|
~any(x ~= y)
|
~any(x ~= y, "all")
|
isempty(x < y)
|
~any(x < y)
|
~any(x < y, "all")
|
isempty(x && y)
|
~any(x && y)
|
~any(x && y, "all")
|