help-octave
[Top][All Lists]
Advanced

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

Re: a puzzle...


From: Ben Abbott
Subject: Re: a puzzle...
Date: Sat, 04 Feb 2012 14:04:26 -0500

On Feb 4, 2012, at 1:12 PM, Muhali wrote:

>> Did you include the single-quotes, like below ?
>> 
>>      y = feval ('@fB', w);
> 
> I used no quotes.
> 
>> What version of Octave are you running ? Do you get the same result from
>> Octave's command line as when you run from your shell's prompt.
> 
> Same result interactively or from the shell. It was done using
> 
> 846273dae16b (stable)
> 
> Are you sure that when you ran the handle version (@) the function fB was
> not somehow referenced before?
> 
> M.

ahh ... I had placed all the functions into one script. That works. When I 
place each function in separate file and make a slight mod to fA.m ...

function y = fA (x, f)
  global gfun
  if nargin < 2
    disp ("nargin < 2")
    y = fA(x, gfun);
  else
    disp ("nargin >= 2")
    w = feval (f, x)
    y = feval (@fB, w);
  endif
endfunction

Then running foo.m gives ...

foo
w =  2.7183
error: `w' undefined near line 9 column 21
error: evaluating argument list element number 2
error: called from:
error:   /Users/bpabbott/Development/Octave_Toolbox/misc/Muhali/fA.m at line 9, 
column 7
error:   /Users/bpabbott/Development/Octave_Toolbox/misc/Muhali/fA.m at line 5, 
column 7
error:   /Users/bpabbott/Development/Octave_Toolbox/misc/Muhali/foo.m at line 
4, column 3

This looks like a bug to me. I've made some minor changes to  your example and 
zipped them up. Running the modified foo.m, I get ....

 foo
w =  2.7183
y =  2.7183
w =  2.7183
error: `w' undefined near line 7 column 21
error: evaluating argument list element number 2
error: called from:
error:   /Users/bpabbott/Development/Octave_Toolbox/misc/Muhali/fA.m at line 7, 
column 7
error:   /Users/bpabbott/Development/Octave_Toolbox/misc/Muhali/fA.m at line 4, 
column 7
error:   /Users/bpabbott/Development/Octave_Toolbox/misc/Muhali/foo.m at line 
8, column 3

I'll file a bug report.

Ben

Attachment: Archive.zip
Description: Zip archive


reply via email to

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