octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Ignorance


From: Jordi Gutiérrez Hermoso
Subject: Re: Ignorance
Date: Mon, 5 Mar 2012 20:05:16 -0500

On 5 March 2012 19:59, Robert T. Short <address@hidden> wrote:
> Is there a one-liner to create an array like
>
> [ [1 2 3 4];
>  [1 2 3 4];
>  [1 2 3 4] ];

One line? Hmm....

    [ 1 2 3 4; 1 2 3 4; 1 2 3 4]

> or
>
> [ [1 1];
>  [2 2];
>  [3 3] ];

    [1 1; 2 2; 3 3]

...

Sorry, I crack myself up.

Seriously, you might want repmat.

More seriously, you probably want broadcasting:

    http://www.gnu.org/software/octave/doc/interpreter/Broadcasting.html

HTH,
- Jordi G. H.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]