|MATLAB Function Reference|
Determine if all array elements are nonzero
B = all(A)
tests whether all the elements along various dimensions of an array are nonzero or logical
A is a vector,
all(A) returns logical
true) if all the elements are nonzero and returns logical
false) if one or more elements are zero.
A is a matrix,
all(A) treats the columns of
A as vectors, returning a row vector of logical
A is a multidimensional array,
all(A) treats the values along the first nonsingleton dimension as vectors, returning a logical condition for each vector.
B = all(A, tests along the dimension of
A specified by scalar
B = (A < 0.5) returns logical
true) only where
A is less than one half:
all function reduces such a vector of logical conditions to a single condition. In this case,
all particularly useful in
where code is executed depending on a single condition, not a vector of possibly conflicting conditions.
all function twice to a matrix, as in
all(all(A)), always reduces it to a scalar condition.
any, logical operators (elementwise and short-circuit), relational operators,
Other functions that collapse an array's dimensions include
© 1994-2005 The MathWorks, Inc.