octave-maintainers
[Top][All Lists]
Advanced

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

Re: Ignorance


From: Daniel J Sebald
Subject: Re: Ignorance
Date: Mon, 05 Mar 2012 19:17:27 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111108 Fedora/3.1.16-1.fc14 Thunderbird/3.1.16

On 03/05/2012 07: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.

Or outer product, ones(4,1)*[1:4].  Probably several ways.

This list is more geared for questions about bugs, new features, better programming, etc. as opposed to questions about how to use the language.

Octave has a very nice help feature. "help" followed by the name of the function of interest. Sometimes the blurb has a "see also". Then there is the "doc" help feature which gives an overview of arithmetic expressions, syntax, so on.

Dan


reply via email to

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