help-octave
[Top][All Lists]

## RE: A Simple Matrix Construction Question

 From: David Pruitt Subject: RE: A Simple Matrix Construction Question Date: Thu, 23 Jan 2003 13:34:26 -0600

```This is known as "Tony's trick" from the Matlab support website.  My
question is: why does this work?

-----Original Message-----
Sent: Thursday, January 23, 2003 1:28 PM
To: Craig Stoudt
Subject: Re: A Simple Matrix Construction Question

I think the preferred way is

X = Y(:,ones(M,1));

Heber

On Thursday, January 23, 2003, at 12:35 PM, Craig Stoudt wrote:

> There is probably a really simple way to do the
> following, but I'm suffering from a mental block.
>
> I have a row array 'Y' of arbitrary length, 1xn.
>
> I want to create an mxn matrix where all of the rows
> are the same as 'Y'.
>
> Of course, I want to do this without resorting to
> loops.
>
>
> __________________________________________________
> Do you Yahoo!?
> http://mailplus.yahoo.com
>
>
>
> -------------------------------------------------------------
> Octave is freely available under the terms of the GNU GPL.
>
> Octave's home on the web:  http://www.octave.org
> How to fund new projects:  http://www.octave.org/funding.html
> Subscription information:  http://www.octave.org/archive.html
> -------------------------------------------------------------
>

-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------

-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------

```