help-octave
[Top][All Lists]
Advanced

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

Re: creating xyz-array


From: louis scott
Subject: Re: creating xyz-array
Date: Wed, 13 Feb 2013 10:45:58 +0000

indx  = .1:.1:.5;
indxlist = zeros(size(indx).^3,3);
ith=1;
# loops were expensive, http://www.gnu.org/software/octave/doc/interpreter/Basic-Vectorization.html
# perhaps a repmat on the inner loop z, but for pedagogical purposes, this is what you want.
for xx = indx
   for yy = indx
      for z = indx
         indxlist(ith,:) = [ xx yy zz];
         ith = ith+1;
       end
   end
end
indxlist(sum(indxlist) == 0) = []; # clean up not needed, but you may wish to exclude other points, and this is a way to do it - as a constraint

On Wed, Feb 13, 2013 at 9:53 AM, Hugo Coolens <address@hidden> 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

_______________________________________________
Help-octave mailing list
address@hidden
https://mailman.cae.wisc.edu/listinfo/help-octave



reply via email to

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