|
You may try things like find(x(x),1,'last'), or numel(x(x)), but sum(x(:))
is faster.
-rajiv
"Shaddy " <s.shokrallaREMOVETHIS@gmail.com> wrote in message
news:gkqv6p$70h$1@fred.mathworks.com...
> Hi All,
>
> I'm wondering if there's a function out there to count the number of true
> values in a boolean matrix. I know that the sum function does the trick
> (even though the sum of a number of true values doesn't really make
> sense), but I assume that this is rather slow and there would be a
> function out there that is optimized for use on boolean matrices.
>
> Thanks,
|