[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
function handles & closures - porting from matlab
From: |
Ian Rickard |
Subject: |
function handles & closures - porting from matlab |
Date: |
Wed, 29 Jul 2009 09:54:16 -0700 |
I'm currently trying to port a code base from matlab to octave. It
uses the following pattern extensively:
function fns = gen_poly_funs(n)
fns = arrayfun(@(n)(@(x)x.^n),0:n,'UniformOutput',false);
end
As far as I can tell this pattern breaks in Octave, as there appears
to be a single global value for n. Is there an easy way to mimic
matlab's behavior where the n is unique for each of the returned
function handles?
- function handles & closures - porting from matlab,
Ian Rickard <=