Path: news.mathworks.com!not-for-mail
From: "Vinayagam " <bkvinay2001@yahoo.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: cell array
Date: Fri, 23 Oct 2009 08:57:04 +0000 (UTC)
Organization: Emmeskay Inc
Lines: 28
Message-ID: <hbrr50$gfq$1@fred.mathworks.com>
References: <hbrp39$me3$1@fred.mathworks.com>
Reply-To: "Vinayagam " <bkvinay2001@yahoo.com>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1256288224 16890 172.30.248.38 (23 Oct 2009 08:57:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 23 Oct 2009 08:57:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1269300
Xref: news.mathworks.com comp.soft-sys.matlab:579521


Try this one,

[Z{:,1}]'-[Z{:,2}]'.

--
Vinayagam.

"sujata " <sujatagp@gmail.com> wrote in message <hbrp39$me3$1@fred.mathworks.com>...
> I have a 5 by 2 cell array that is only filled with numbers. Something like this:
> Z = 
>    [ 1.6168]    [ 0.8652]
>     [ 0.5724]    [ 0.2323]
>     [ 2.5916]    [ 2.6805]
>     [-5.1700]    [      0]
>     [ 1.4836]    [ 0.4542]
>     [-0.1367]    [      0]
>     [ 2.5100]    [ 2.9110]
>            []           []
>     [ 1.7531]    [ 1.7531]
>     [-0.6462]    [-0.6462]
> 
> but i want to take the difference between these two columns. Since it is an cell array this is not possible to simply do Z(:,1)-Z(:,2).
> 
> I could use a for loop but i want to avoid using that. I also looked in the documentation for cell conversions but so far no luck. 
> 
> Does anyone know (if) there is an alternative way to do this?
> 
> Thanks