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 17:29:02 +0000 (UTC)
Organization: Universit&#228;tsSpital Z&#252;rich
Lines: 30
Message-ID: <fn7tgu$g8r$1@fred.mathworks.com>
References: <fn70o9$184$1@fred.mathworks.com> <fn73ei$afj$1@fred.mathworks.com> <fn7o0n$gvg$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1201109342 16667 172.30.248.37 (23 Jan 2008 17:29:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 23 Jan 2008 17:29:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 11
Xref: news.mathworks.com comp.soft-sys.matlab:447259



"Andrew ":
<SNIP changing the problem...

> Thanks but these solutions do not quite achieve what I am
> looking for.
> In the example above v is a cell array of cell
> arrays. I am looking to produce a single cell array where
> v(1,1) is 'first', v(1,2)=1, v(2,1)='second' and so on...

well, what you want NOW is NOT what you wanted before...
running your initial example yields this

     Test.test(1,1) % <- array index
%          {1x1 cell}
     Test.test{1,1} % <- cell contents
%          'First' % -> now your v(1,1)

your <acutal> example could be achieved by this

     clear s;
     b={'first','second'};
     c=[1,2];
     d=num2cell(c);
     s.f=[b.',d.'];
% some results
     s.f
     s.f(1,1)
     s.f(2,2)

us