all
Test whether all elements of an array are nonzero.
Syntax
Section titled “Syntax”B = all(A)B = all(A, dim)B = all(A, 'all')Description
Section titled “Description”Returns logical true (1) if all elements of A along the operating dimension are nonzero (or true), false (0) otherwise. With no dimension argument, operates along the first non-singleton dimension. With 'all', reduces every element to a single scalar.
Examples
Section titled “Examples”all([1 1 1]) % 1all([1 0 1]) % 0all([1 1; 1 0]) % [1 0] per-columnall([1 1; 1 0], 'all') % 0See also
Section titled “See also”Also categorized under: Range Functions / Math.