Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Vectorization with cell array
Date: Thu, 24 Jan 2008 09:36:02 +0000 (UTC)
Organization: Toyota Motorsport GmbH
Lines: 38
Message-ID: <fn9m62$6tl$1@fred.mathworks.com>
References: <fn70o9$184$1@fred.mathworks.com> <fn73ei$afj$1@fred.mathworks.com> <fn7o0n$gvg$1@fred.mathworks.com> <fn7tgu$g8r$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 1201167362 7093 172.30.248.37 (24 Jan 2008 09:36:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 24 Jan 2008 09:36:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1185999
Xref: news.mathworks.com comp.soft-sys.matlab:447369



"us " <us@neurol.unizh.ch> wrote in message
<fn7tgu$g8r$1@fred.mathworks.com>...
> "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
Thanks for the reply again. This is what I wanted to do and
if you do run the example I gave in my first post using
ndx(1) and ndx(2) you will end up with the same cell array
as you acheived by vectorization.

I appreciate the help! Andrew