[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #46004] ezplot fails to recognise functions wi
From: |
Tasos Papastylianou |
Subject: |
[Octave-bug-tracker] [bug #46004] ezplot fails to recognise functions with 2 arguments passed as handles |
Date: |
Sun, 20 Sep 2015 13:55:55 +0000 |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:40.0) Gecko/20100101 Firefox/40.0 |
Follow-up Comment #2, bug #46004 (project octave):
Thanks, Mike! You're right about the caller workspace. This will allow handles
to subfunctions to also work.
As for handles to nested functions, octave complains that these are not
implemented yet, but in theory when they do, the fix should work for those
too.
Also, somewhat less ugly-looking fix. Under line 135 of __ezplot__.m insert:
if evalin('caller','nargin(varargin{1})') == 2; args{2} = "y"; end
(in theory, _if nargin(fun) == 2_ should have worked too since _fun_ was
instantiated from _varargin{1}_, but this produces an error ... don't know
why, but let's not waste time figuring out why)
To test:
* in file Bar.m
function Bar(Domain)
% Function Bar
ezplot(@Foo,Domain);
endfunction
function Out = Foo(a,b)
% Subfunction Foo
if nargin < 2; b = 5; end
Out = a-b;
endfunction
* at the console
Bar([0,10,0,10]);
Note: For some reason when fixing __ezplot__.m you need to restart octave for
the fix to take effect.
Not sure why, presumably private functions are preloaded in memory or
sth?
Just pointing this out in case someone tries the fix and runs without
restarting and thinks the fix doesn't work.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?46004>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/