Path: news.mathworks.com!not-for-mail
From: "Jeff Hajewski" <jhajewsk@indiana.edu>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Issue with horzcat
Date: Tue, 14 Apr 2009 17:50:18 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 50
Message-ID: <gs2icq$b0m$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>
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 1239731418 11286 172.30.248.38 (14 Apr 2009 17:50:18 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 14 Apr 2009 17:50:18 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 942762
Xref: news.mathworks.com comp.soft-sys.matlab:532703


"Matt " <xys@whatever.com> wrote in message <gs2g1c$k4g$1@fred.mathworks.com>...
> "Jeff " <jhajewsk@indiana.edu> wrote in message <gs2ah1$ff4$1@fred.mathworks.com>...
> > "Matt Fig" <spamanon@yahoo.com> wrote in message <gs1191$q0a$1@fred.mathworks.com>...
> > > Since you give the dimensions, I will give it a try:
> > > 
> > > 
> > > >> ortPMat = rand(2,51);
> > > >> newPoint = rand(2,1);
> > > >> horzcat(ortPMat,newPoint);
> > > >> 
> > > 
> > > 
> > > No problem.  Why are you taking the transpose?
> > 
> > Well ortPmat is a 51X2 matrix so I have to take the transpose to make it 2X51. I don't know a lot of the in depth details of Matlab but transposing a matrix AFTER I have matlab output its size affects the size that is put out (at least that is what was happening last night). Thanks a lot for your help
> -----------------
> 
> At this point, one can only assume that the efforts you made to determine the actual dimensions of the matrices were unsuccessful. Something may have happened to change the matrices between the time when you displayed them and the line where your code crashes.
> 
> The thing to do is to type
> 
> >>dbstop if error
> 
> and then rerun the code. When the code crashes, you will get the K>> prompt at which point you should type
> 
> K>>whos ortPMat newPoint
> 
> This will display the matrices' dimensions at the actual point in the code where the crash occurs.

I did just as you said and it still says the dimensions are what I thought. Here is what Matlab said

??? Error using ==> horzcat
All matrices on a row in the bracketed expression must have the 
 same number of rows.

Error in ==> buildCurve at 45
    ortPmat = horzcat(ortPmat', newPoint);

45      ortPmat = horzcat(ortPmat', newPoint);
K>> whos ortPmat newPoint
  Name           Size                    Bytes  Class

  newPoint       2x1                        16  double array
  ortPmat        2x51                      816  double array

Grand total is 104 elements using 832 bytes

This error doesn't make sense to me because they have the same number of rows.

Jeff