Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Vectorization with cell array
Date: Wed, 23 Jan 2008 09:18:01 +0000 (UTC)
Organization: Toyota Motorsport GmbH
Lines: 15
Message-ID: <fn70o9$184$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1201079881 1284 172.30.248.35 (23 Jan 2008 09:18:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 23 Jan 2008 09:18:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1185999
Xref: news.mathworks.com comp.soft-sys.matlab:447130



I have a problem whereby I wish to vectorize the assignment
to a cell array. If I have
ndx=1:2;
B(ndx)={'First', 'Second'};
C(ndx)=[1 2];
I can then create a structure with a cell array by
Test.test(ndx(1),:)={B(ndx(1)), C(ndx(1))};
and do the same for ndx(2), but how to do the following:
Test.test(ndx,:)={B(ndx), C(ndx)};
hence getting rid of the for loop. I have been looking at
functions like cellfun and arrayfun, but no luck yet.

Thanks in advance for the help.
Andrew