Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: avoid forloop
Date: Thu, 22 Apr 2010 22:50:26 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 19
Message-ID: <hqqjri$o43$1@fred.mathworks.com>
References: <hqqhm2$ipj$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1271976626 24707 172.30.248.37 (22 Apr 2010 22:50:26 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 22 Apr 2010 22:50:26 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:629048

"Juliette Salexa" <juliette.physicist@gmail.com> wrote in message <hqqhm2$ipj$1@fred.mathworks.com>...
> Is there a way to avoid the forloop here:
> 
> for i=1:10000000
> b(i)=matrix2num(a(i,:));
> end
> 
> ?
> 
> Perhaps using cell arrays ?
--------------------
 n = size(a,2);
 b = a*10.^((n-1:-1:0).');

I am assuming your matrix2num is the one written by Aman Siddiqi at:
http://www.mathworks.nl/matlabcentral/fileexchange/7264
which in this case converts decimal digits to decimal numbers.

Roger Stafford