Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Vectorization with cell array
Date: Wed, 23 Jan 2008 10:04:02 +0000 (UTC)
Organization: Universit&#228;tsSpital Z&#252;rich
Lines: 18
Message-ID: <fn73ei$afj$1@fred.mathworks.com>
References: <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 1201082642 10739 172.30.248.35 (23 Jan 2008 10:04:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 23 Jan 2008 10:04:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 11
Xref: news.mathworks.com comp.soft-sys.matlab:447141



"Andrew ":
<SNIP cell acrobatics...

one of the solutions

% the data
     b={'first','second'};
     c=[1,2];
% the engine
     clear s v; % save old stuff!
     v=cellfun(@(a,b) {a,b},b,num2cell(c),'uni',false);
     s=struct('f',v);
% the result
     s.f
% ans = 'first' [1]
% ans = 'second' [2]

us