help-octave
[Top][All Lists]
Advanced

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

Re: creating xyz-array


From: Ben Abbott
Subject: Re: creating xyz-array
Date: Wed, 13 Feb 2013 07:56:41 -0500

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



reply via email to

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