Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: count number of 1's in the matrix
Date: Tue, 30 Jun 2009 20:33:01 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 7
Message-ID: <h2dspt$pgv$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1246393981 26143 172.30.248.38 (30 Jun 2009 20:33:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 30 Jun 2009 20:33:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1875128
Xref: news.mathworks.com comp.soft-sys.matlab:551824


Hi 
I have a matrix with 0's, 1's.  I want to count the number of 1's. 
A = [1 0 0 0 1 0; 1 0 0 0 1 1; 0 0 0 0 1 1]

What is the most efficient way of doing this?
Thanks
Diego