The code applies the isempty
function to the entire result of a
find
operation. It is sufficient to request a single output from
find
, and then apply isempty
to that
single output.
Replace code such as isempty(find(A))
with code such as
isempty(find(A,1))
where A is an arbitrary expression
giving a logical value.
If A is a vector, use the simpler and faster form, ~any(A)
.
If A is an arbitrary matrix, another good alternative is
~any(A(:))
.
In general, Code Analyzer does not know the shape of A
, so
it does not offer these alternatives as automatic fixes.