Ideas?
I am running 2009a (R17, in old terms, I think).
anyAreTrue = any(A(:));
Edit: To explain people who are not familiar with the syntax, A(:) uses the colon operator to get the entire contents of the array A, regardless of the size, and reshape them into a single column vector (size numberl) (A)×1). The operation on the result column vector only needs to call ANY once.
I am testing an arbitrarily large and arbitrarily sized logical array, and I want to know if there is one of them or Multiple is true. any() can only work in one dimension at a time, so does sum(). I know I can test the number of dimensions and repeat any() until I get an answer, but I want one more Faster, more frank, and more elegant method.
Ideas?
I am running 2009a (R17, in the old parlance, I think).
If your data is in matrix A, Please try the following:
anyAreTrue = any(A(:));
Edit: To explain people who are not familiar with the grammar, A (:) Use the colon operator to get the entire contents of the array A, regardless of the size, and reshape them into a single column vector (size numberl) (A)×1). The operation on the result column vector only needs to call ANY once.