[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: feval call to a subfunction fails when it is in a subfunction
From: |
Ben Abbott |
Subject: |
Re: feval call to a subfunction fails when it is in a subfunction |
Date: |
Wed, 30 Sep 2009 21:53:45 -0400 |
On Sep 30, 2009, at 9:40 PM, Sidney Markowitz wrote:
I'm new to using Octave and don't know if this is a bug in my code, a
bug in Octave, or something wrong with my installed copy of Octave.
The following code demonstrates the problem. The first feval, in the
main function, works and the result is displayed. The other feval,
inside the subfunction switchyard2, gets an error in line 9
error: feval: function `mysin' not found
I am using Octave version 3.2.2 compiled on my Macbook under MacOS
10.6.1, downloaded and built from Macports. I put the following text
in
a file named ./switchyard.m and invoked it in the Octave command
line by
typing switchyard(10)
Do others get the same results? Is there a bug in my example code?
Is it
a bug in Octave?
function y = switchyard(x)
z = feval('mysin', x);
disp(z);
y = switchyard2(x);
return;
endfunction
function y = switchyard2(x)
y = feval('mysin', x);
return;
endfunction
function y= mysin(x)
y = sin(x);
return;
endfunction
It appears that I'm getting the same.
octave-3.2.2:4> switchyard(pi)
1.2246e-16
error: feval: function `mysin' not found
error: called from:
error: /Users/bpabbott/switchyard.m at line 9, column 5
error: /Users/bpabbott/switchyard.m at line 4, column 6
01 function y = switchyard(x)
02 z = feval('mysin', x);
03 disp(z);
04 y = switchyard2(x);
05 return;
06 endfunction
07
08 function y = switchyard2(x)
09 y = feval('mysin', x);
10 return;
11 endfunction
12
13 function y= mysin(x)
14 y = sin(x);
15 return;
16 endfunction
I'm also running Mac OS 10.6.
I'm presently building the developers sources, so I can't check them
till tomorrow.
Ben