help-octave
[Top][All Lists]

## Re: A Simple Matrix Construction Question

 From: Carlo de Falco Subject: Re: A Simple Matrix Construction Question Date: Thu, 23 Jan 2003 20:46:34 +0100

```
GiovedÃ¬, 23 Gen 2003, alle 20:34 Europe/Rome, David Pruitt ha scritto:

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

```
```
M = Y(ones(5,1),:)

means:

M = [   Y(1,1:5)
Y(1,1:5)
Y(1,1:5)
Y(1,1:5)
Y(1,1:5)
];

```
in other words, replicate Y five times with first index always 1 and second index spanning 1:5
```neat!
c.

Thanks, for teaching me the trick, Iago.

```
------------------------------------------------------------------------ --
```Carlo de Falco
Dipartimento di Matematica "F. Brioschi"
Politecnico di Milano
Piazza Leonardo da Vinci, 32
20133 Milano, Italy
tel:   +39-02-23994604
fax:   +39-02-23994588
Have a look at:
http://mox.polimi.it
```
------------------------------------------------------------------------ --
```

-------------------------------------------------------------
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
-------------------------------------------------------------

```