help-octave
[Top][All Lists]
Advanced

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

how do I vectorize this?


From: Claudio Belotti
Subject: how do I vectorize this?
Date: Thu, 13 Apr 2006 17:39:21 +0200
User-agent: Mutt/1.5.11+cvs20060126

Dear all,
I have a set of values z spread over an x-y plane
I want to average the values on a fixed grid (xi,yi).

I use:
xidx = lookup(xi,x)
yidx = lookup(yi,y)
zidx = sub2ind(sizeofgrid, xidx, yidx)

and then

for i=1:length(zidx)
 zi( zidx(i)) += z(i)
 ni( zidx(i)) += 1
endfor
zi = zi./ni

my question is: how do I vectorize the for-loop above?

cheers
Claudio

-- 
Claudio Belotti




-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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