Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Fitting N(N-1) points on an NxN matrix
Date: Sat, 1 Dec 2012 14:30:08 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 23
Message-ID: <k9d49g$hnq$1@newscl01ah.mathworks.com>
References: <k9d2ku$dal$1@newscl01ah.mathworks.com> <k9d2uc$e4h$1@newscl01ah.mathworks.com> <k9d3hb$fnh$1@newscl01ah.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: www-05-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1354372208 18170 172.30.248.37 (1 Dec 2012 14:30:08 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sat, 1 Dec 2012 14:30:08 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 3554966
Xref: news.mathworks.com comp.soft-sys.matlab:783943

Thanks!


"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <k9d3hb$fnh$1@newscl01ah.mathworks.com>...
> "Vic" wrote in message <k9d2uc$e4h$1@newscl01ah.mathworks.com>...
> > Sorry this was meant to be in the "Answers" section....
> > 
> > "Vic" wrote in message <k9d2ku$dal$1@newscl01ah.mathworks.com>...
> > > Suppose I have an N(N-1) vector that corresponds to each non-diagonal entry of an NxN matrix. Is there anyway that I can encode that onto my matrix?
> > > 
> > > i.e. For n=3, given [ 2 3 4 5 6 7 ] we obtain
> > > 
> > > [0 4 6 ;
> > >  2 0 7 ;
> > >  3 5 0]?
> 
> n = 3;
> x =  [ 2 3 4 5 6 7 ] 
> 
> A = zeros(n);
> A(setdiff(1:n^2,1:n+1:n^2)) = x
> 
> % Bruno