I am testing an arbitrarily large, arbitrarily given array of logic elements, and I would like to know if any of them are true. any()only works on one dimension at a time, like sum(). I know that I can check the number of measurements and repeat any()until I get one answer, but I would like a faster and more frankly more elegant approach.
any()
sum()
Ideas?
I am launching 2009a (R17, in the old language, I think).
If your data is in matrix A , try the following:
anyAreTrue = any(A(:));
EDIT: , , A (:) , A, , - ( numel (A) -by- 1). ANY.
, . . ,
( (:))
, true, numel (A) .
( (, [], 1))
reshape. , , - . , , :
======================
= myany (A)
% ,
result = any (A (:));
m . MATLAB ( ) - . - , , , . , .
Source: https://habr.com/ru/post/1705790/More articles:How to get a bug report from the "Please tell Microsoft about it" dialog? - windows-xpWhen is target binding updated for complex paths? - c #Creating a RAD7 project from the command line - javaConfiguration Management with Subversion and SharePoint - version-controlHTML Angle Character Display - htmlJavascript "Namespaces" and jQuery AJAX - jsonКак получить доступ к последовательным элементам в объекте IQueryable? - c#How to display success message in Struts? - javaSharePoint Domains and Content Query Web Part - dnsIs it possible to get the MSIL delegate from C #? - c #All Articles