any
any of the elements of a matrix satisfy some condition.
📝Syntax
R = any(M)
R = any(M, dim)
R = any(M, 'all')
📥Input Arguments
Parameter Description
M a matrix.
dim a integer value: dimension along it works.
'all' tests over all elements of M.
📤Output Arguments
Parameter Description
R a logical matrix.
📄Description

any returns true if any of the elements of a matrix satisfy some condition.

Sparse logical, double, single, complex double, and complex single inputs are supported. Sparse numeric zeros are treated as false and nonzero real or complex entries are treated as true.

💡Examples
any([33, 22; 11, 0])
any([33, 22; 11, 0], 2)
S = sparse(single([0 0; 2 + 1i 3]));
any(S)
any(S, 'all')
🔗See Also
all
🕔Version History
Version Description
1.0.0 initial version
1.6.0 manages input argument 'all'
2.0.0 added sparse single and complex single support
Edit this page on GitHub