[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #36221] using ~ as optional output for unique
From: |
John W. Eaton |
Subject: |
[Octave-bug-tracker] [bug #36221] using ~ as optional output for unique causes error in ismember |
Date: |
Wed, 18 Apr 2012 17:21:52 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:10.0.2) Gecko/20100101 Firefox/10.0.2 Iceweasel/10.0.2 |
Follow-up Comment #4, bug #36221 (project octave):
With your function
function varargout = newdeal (varargin)
for n = 1:nargin
if (isargout (n))
varargout(n) = varargin(n);
endif
endfor
printf ("nargin = %d, nargout = %d, isargout(%d) = %d\n",
nargin (), nargout (), nargout (), isargout (nargout ()))
endfunction
I see the following:
octave:2> [a1, b1, c1] = newdeal (1, 2, 3);
nargin = 3, nargout = 3, isargout(3) = 1
octave:3> [a2, b2, ~] = newdeal (1, 2, 3);
nargin = 3, nargout = 3, isargout(3) = 0
error: element number 3 undefined in return list
octave:3> [a3, b3, c3] = newdeal (1, 2, 3);
nargin = 3, nargout = 3, isargout(3) = 0
error: element number 3 undefined in return list
I think that in the third call to newdeal, isargout(3) should be true and the
call should succeed. It seems like isargout is somehow sticky and I don't
think it should be. Or am I misunderstanding something here?
Also, if isargout(N) is true, I think we should be able to completely omit
setting a value for that output. The point of isargout is to be able to avoid
calculation, but I think it would annoying if we still had to set values (even
if just []) for unused output values.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?36221>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #36221] using ~ as optional output for unique causes error in ismember, anonymous, 2012/04/17
- Message not available
- [Octave-bug-tracker] [bug #36221] using ~ as optional output for unique causes error in ismember, John Hunt, 2012/04/18
- [Octave-bug-tracker] [bug #36221] using ~ as optional output for unique causes error in ismember, Ben Abbott, 2012/04/18
- [Octave-bug-tracker] [bug #36221] using ~ as optional output for unique causes error in ismember,
John W. Eaton <=
- [Octave-bug-tracker] [bug #36221] using ~ as optional output for unique causes error in ismember, John W. Eaton, 2012/04/18
- [Octave-bug-tracker] [bug #36221] using ~ as optional output for unique causes error in ismember, Ben Abbott, 2012/04/18
- [Octave-bug-tracker] [bug #36221] using ~ as optional output for unique causes error in ismember, John W. Eaton, 2012/04/18
- [Octave-bug-tracker] [bug #36221] using ~ as optional output for unique causes error in ismember, John W. Eaton, 2012/04/18
- Message not available
- Message not available
- [Octave-bug-tracker] [bug #36221] using ~ as optional output for unique causes error in ismember, John W. Eaton, 2012/04/18
- Message not available
- [Octave-bug-tracker] [bug #36221] using ~ as optional output for unique causes error in ismember, John W. Eaton, 2012/04/19
- [Octave-bug-tracker] [bug #36221] using ~ as optional output for unique causes error in ismember, John W. Eaton, 2012/04/19