help-octave
[Top][All Lists]
Advanced

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

Re: creating xyz-array


From: Hugo Coolens
Subject: Re: creating xyz-array
Date: Wed, 13 Feb 2013 16:14:38 +0100



2013/2/13 Ben Abbott <address@hidden>
On Feb 13, 2013, at 4:53 AM, Hugo Coolens wrote:

> I need to create an array which addresses all points xyz (except (0,0,0) with a resolution of e.g. 0.1 from 0.1 to 0.5
>
> something like this
>
> 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
>
> I was wondering whether octave has a pre-built function to generate this kind of array?
>
> thanks in advance
> hugo

This should do what you want.

        [x, y, z] = ndgrid (0.1:0.1:0.5);
        [x(:), y(:), z(:)]

Ben

thanks a lot, this is what I needed

best regards,
hugo

reply via email to

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