[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #33935] demo function humps is not defined
From: |
John W. Eaton |
Subject: |
[Octave-bug-tracker] [bug #33935] demo function humps is not defined |
Date: |
Tue, 31 Jan 2017 12:06:23 +0000 (UTC) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0 |
Follow-up Comment #7, bug #33935 (project octave):
In Octave, we don't error on nargout being too large, we just let it go and
then you get a generic warning about undefined outputs.
If you call error before print_usage, the print_usage function will never be
executed.
Instead of checking nargin, you could use a default input value.
The whole function could then be
function varargout = humps (x = [0:0.05:1])
if (nargin > 1)
print_usage ();
endif
y = ...;
if (nargout > 1)
varargout = {x, y};
else
varargout = {y};
endif
endfunction
Also, @var{x} will capitalize its argument when generating Info output, but
will not when generating TeX output (it uses a slanted font instead), so you
should write @var{x}, not @var{X}.
Could someone make those changes and also create a proper changeset that adds
this file to some directory (which one? Octave doesn't currently have a demos
directory), updates the corresponding module.mk file, and adds the function to
the manual?
I suppose it could be included along with sombrero and peaks. Maybe make it
plot the function if nargout is 0?
And, for completeness, maybe add a test or two just so it doesn't add to the
count of functions without tests?
Thanks.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?33935>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/