From: Greg Heath <>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Duplicate matrix by a number of columns
Date: Sat, 14 May 2011 10:43:12 -0700 (PDT)
Lines: 32
Message-ID: <>
References: <iqmb3e$8v1$> <iqmek0$ihv$>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: 1305394992 15377 (14 May 2011 17:43:12 GMT)
NNTP-Posting-Date: Sat, 14 May 2011 17:43:12 +0000 (UTC)
Injection-Info:; posting-host=; posting-account=mUealwkAAACvQrLWvunjg50tRAnsNtJR
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR
 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729),gzip(gfe)
Xref: comp.soft-sys.matlab:726820

On May 14, 1:37 pm, "Roger Stafford"
<> wrote:
> "Andy" wrote in message <iqmb3e$>...
> > I am a Matlab newbie and  in need help getting some stuff done. My problem is that I A size(106,20503) and matrix B of size (106,1). I want to determine the correlation coefficient of matrix B and all the columns in matrix A. I am not getting any success because the two matrices have different sizes. My idea is to duplicate the columns in matrix B to have the same size as A (106, 20503) whiles keeping the individual elements the same.
> > Any ideas how to do this?
> > Thanks in advance
> > ~ Andy
> - - - - - - - - - - - -
>   Why not devise your own correlation computation?  It's simple enough.  Subtract the mean value of each column of A and of B itself from each of their respective elements.  Then divide the resulting elements by the square root of the sum of the squares of the >respective columns.  

help zscore
doc zscore

>Finally you can obtain the correlation by simple matrix multiplication of the resulting revised A2'*B2 to get correlation in a 20503 by 1 column vector.  The 'bsxfun' function is useful in doing >the above.

Hope this helps