Path: news.mathworks.com!not-for-mail
From: "Jeff Hajewski" <jhajewsk@indiana.edu>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Issue with horzcat
Date: Thu, 16 Apr 2009 00:39:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 36
Message-ID: <gs5un6$gd3$1@fred.mathworks.com>
References: <gs10ep$1vr$1@fred.mathworks.com> <gs1191$q0a$1@fred.mathworks.com> <gs2ah1$ff4$1@fred.mathworks.com> <gs2g1c$k4g$1@fred.mathworks.com> <gs2icq$b0m$1@fred.mathworks.com> <gs2jaa$gv1$1@fred.mathworks.com> <gs2kdv$k1j$1@fred.mathworks.com> <gs2l0m$khd$1@fred.mathworks.com> <gs30g5$dr8$1@fred.mathworks.com> <gs32nd$f1j$1@fred.mathworks.com> <gs38mm$4pv$1@fred.mathworks.com> <gs3ek1$7sk$1@fred.mathworks.com>
Reply-To: "Jeff Hajewski" <jhajewsk@indiana.edu>
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 1239842342 16803 172.30.248.38 (16 Apr 2009 00:39:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 16 Apr 2009 00:39:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 942762
Xref: news.mathworks.com comp.soft-sys.matlab:533072


Very nice. Thanks a lot- that solved the problem

Jeff

"Jiro Doke" <jiro.doke@mathworks.com> wrote in message <gs3ek1$7sk$1@fred.mathworks.com>...
> "Jeff Hajewski" <jhajewsk@indiana.edu> wrote in message <gs38mm$4pv$1@fred.mathworks.com>...
> > 
> > Here is the code after taking away the transpose:
> > 
> 
> *<snip>*
> 
> >     ortPmat = horzcat(ortPmat, newPoint);
> >     ortPmat = sortrows(ortPmat.');
> > 
> 
> Okay, I think the problem happens here (and the fact that this runs in a loop, recursively). After you do "horzcat", you transpose it to do "sortrows" (I assume you want to sort by columns). You should transpose it back:
> 
> ortPmat = sortrows(ortPmat.').';
> 
> 
> Then, of course, you may have to fix the rest of the code below. *This may not be completely accurate, but here goes*
> 
> NegCopyPmat = ortPmat;
> NegCopyPmat(1,:) = NegCopyPmat(1,:) - 2*pi;
> PosCopyPmat = ortPmat;
> PosCopyPmat(1,:) = PosCopyPmat(1,:) + 2*pi;
> 
> %Concatenate transposes of these matrices.
> periodPmat = [NegCopyPmat ortPmat PosCopyPmat];
> periodPmat = periodPmat; %Transpose back.
> 
> 
> 
> -----
> jiro