|
From: | Bill Denney |
Subject: | Re: Problem porting Matlab code containing feval |
Date: | Tue, 14 Feb 2006 00:24:03 -0500 (EST) |
On Mon, 13 Feb 2006, V P wrote:
Hi All: I am in the process of porting my old Matlab code to Octave since I no longer have access to Matlab. I recreated the problem in the following snippet: function test(fn) yN = [1.2, 0.8]; i=0 while i < 3, feval(fn,yN) i=i+1; end; endfunction; function d=dfns2(y) d1=-1 + 2./2.^(16 *(-3.75 + y(:,1)).^2); d2=-1 + 2./ 2.^((-8 + y(:,2)).^2); d = [d1, d2]; endfunction in Octave (2.1.71) I do the following:test(dfns2)
LUK already suggested one way. Another way would be to pass a function handle like
test(@dfns2)
and change the line from feval(fn,yN) to fn(yN) This may depend on version 2.9.x though. Bill -- "The history of liberty is a history of the limitation of government power, not the increase of it." -- Woodrow Wilson ------------------------------------------------------------- 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 -------------------------------------------------------------
[Prev in Thread] | Current Thread | [Next in Thread] |