octave-maintainers
[Top][All Lists]
Advanced

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

Re: Ignorance


From: Robert T. Short
Subject: Re: Ignorance
Date: Mon, 05 Mar 2012 19:11:19 -0800
User-agent: Mozilla/5.0 (X11; Linux i686; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2

On 03/05/2012 05:05 PM, Jordi Gutiérrez Hermoso wrote:
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.


Well, ask a poorly specified question get a smart answer. You cracked me up too.

I don't know the dimensions or the direction a-priori. The obvious answer is 1:N followed by a repmat but there are so many cute little octave tricks that I was hoping there was something really clever. I am still trying to understand broadcasting in full, but I don't think it quite works for my application. Bob will noodle a bit. Thanks for the response, even it if was a bit of a kick in the private parts.

B


reply via email to

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