Y = all(X)
all(X), where X is a vector, returns 1 if all of the elements of X are nonzero. It returns 0 if any single element is zero. For matrices, all(X) operates on the columns of X, returning a row vector of 1s and 0s.
if statements
because anif all(A < 0.5)do somethingend
if wants to respond to a single condition, not a vector of possibly conflicting suggestions. Applying the function twice, as in all(all(A)), always reduces the matrix to a scalar condition.
&,|,~,any
(c) Copyright 1994 by The MathWorks, Inc.