Path: news.mathworks.com!newsfeed-00.mathworks.com!nlpi057.nbdc.sbc.com!prodigy.net!news.glorb.com!news.aset.psu.edu!support1.mathforum.org!not-for-mail
From: bogfrog <jmcgraw@rcn.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: count number of
Date: Wed, 30 Jul 2008 13:34:44 EDT
Organization: The Math Forum
Lines: 13
Message-ID: <2748437.1217439315576.JavaMail.jakarta@nitrogen.mathforum.org>
References: <g6ptlp$sfm$1@fred.mathworks.com>
NNTP-Posting-Host: nitrogen.mathforum.org
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: support1.mathforum.org 1217439315 30776 144.118.30.135 (30 Jul 2008 17:35:15 GMT)
X-Complaints-To: news@support1.mathforum.org
NNTP-Posting-Date: Wed, 30 Jul 2008 17:35:15 +0000 (UTC)
Xref: news.mathworks.com comp.soft-sys.matlab:482699



> If you're doing this many times in a loop you should
> try of
> the solutions here and see which one is fastest. I
> had come
> up with an alternate method of 
> 
> s=sum(dec2bin(d)=='1') but on my computer the method
> i
> posted above is about twice as fast.

I ended up writing it in C and using a mex file.  Everything in matlab was just too slow.

Thanks, though.