help-octave
[Top][All Lists]
Advanced

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

Re: creating xyz-array


From: Bård Skaflestad
Subject: Re: creating xyz-array
Date: Wed, 13 Feb 2013 14:30:16 +0100

On Wed, 2013-02-13 at 07:56 -0500, Ben Abbott wrote:
> On Feb 13, 2013, at 4:53 AM, Hugo Coolens wrote:
> 
> > 0.1 0.1 0.1
> > 0.1 0.2 0.1
> > 0.1 0.3 0.1
> > 0.1 0.4 0.1
> > 0.1 0.5 0.1
> > 0.1 0.1 0.2
> > 0.1 0.2 0.2
> > 0.1 0.3 0.2
> > 0.1 0.4 0.2
> > 0.1 0.5 0.2
> > .
> > .
> > 0.5 0.5 0.5

> This should do what you want.
> 
>       [x, y, z] = ndgrid (0.1:0.1:0.5);
>       [x(:), y(:), z(:)]

Almost, but not quite.  At least not if he wants *exactly* what's
written above.  Then he wants

        [z(:), x(:), y(:)]

or, for that matter, any of the following

      * shift ([x(:), y(:), z(:)], 1, 2)
      * circshift ([x(:), y(:), z(:)], [0, 1])
      * [x(:), y(:), z(:)] (:, [3, 1, 2])

What other alternatives are there?


Sincerely,
-- 
Bård Skaflestad <address@hidden>



reply via email to

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