Thu 19 Apr 2012 08:25:36 PM UTC, comment #13:
I checked in the following change to fix this problem:
http://hg.savannah.gnu.org/hgweb/octave/rev/000cd393f3c1
This fix will appear in the upcoming 3.6.2 release.
|
Thu 19 Apr 2012 01:27:00 PM UTC, comment #12:
Ben, I see the problem now. It must be related to varargout processing because I don't see it if I use a function like
Sorry about the confusion.
I'll check it out.
|
Thu 19 Apr 2012 11:21:59 AM UTC, comment #11:
I'm seeing the error below
When "~" is used for the last output and it has not been set.
For example, using the newdeal.m function below
The "~" works as expected, except for the last output.
|
Thu 19 Apr 2012 01:04:42 AM UTC, comment #10:
If the output is not used, I see no reason to require it to be set.
|
Thu 19 Apr 2012 12:11:25 AM UTC, comment #9:
Did you intend for the changeset to require the nth output be set? As below, for example?
|
Wed 18 Apr 2012 07:15:37 PM UTC, comment #8:
Oh, wait. Now I remember, Matlab has the special "~" that allows outputs to be ignored, but it doesn't seem to provide a way for a function to check to see whether the outputs are ignored. At least it doesn't seem to have an isargout function.
|
Wed 18 Apr 2012 07:07:48 PM UTC, comment #7:
The originally reported problem is fixed by the changeset I committed, so I don't think there is anything in unique.m that needs to be changed.
I also don't think that we should require that unused outputs must be set to something. Does matlab really require that? So you have to write things like
Anyway, what is left to fix?
|
Wed 18 Apr 2012 06:54:10 PM UTC, comment #6:
John,
I think you are correct that "~" is sticky, and should be fixed.
Regarding omitting setting the value for output's corresponding to "~", I also agree that would be useful. Reading the help string, my impression was that the function still needed to set the value, but that the result would be ignored when returned.
I don't think we need to copy the behavior of Matlab in this instance, but Matlab does throw an error if the output corresponding to "~" is not set.
How would you like to proceed? Should the parser be fixed, or shall unique.m be modified to use nargout instead ?
|
Wed 18 Apr 2012 06:48:23 PM UTC, comment #5:
This bug is fixed with the changeset:
http://hg.savannah.gnu.org/hgweb/octave/rev/6131fead3135
See also bug #36260
|
Wed 18 Apr 2012 05:21:52 PM UTC, comment #4:
With your function
I see the following:
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.
|
Wed 18 Apr 2012 04:23:57 PM UTC, comment #3:
I wrote a simple function that isolates the problem.
Running "test newdeal" ends with
The parser expects the third argument to be set when the "~" is present. I think this is intended. Thus, unique.m should be rewritten to use "(nargout () <= n)" in place of "isargout (n)". For example, modifying the simple example, the version below passes all tests.
|
Wed 18 Apr 2012 02:59:28 PM UTC, comment #2:
this bug is not limited to unique, see #36240
meanwhile you can just avoid trailing ~
(beware that once unique has been called with a trailing ~,
clear unique is mandatory for it to work again)
output from 56 to 60 : same as yours
output from 61 to 64 : works
|
Wed 18 Apr 2012 01:32:19 AM UTC, comment #1:
I tracked the problem a bit. The script below results in an empty "jj" when unique is called the last time.
|
Tue 17 Apr 2012 07:52:37 AM UTC, original submission:
When using ~ as the optional 3rd output argument in the unique function the ismember function using the optional 'rows' argument causes the error:
The error can be reproduced using the code
|