octave-maintainers
[Top][All Lists]
Advanced

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

Re: Matlab-style empty output/input arguments support


From: John W. Eaton
Subject: Re: Matlab-style empty output/input arguments support
Date: Fri, 29 Jan 2010 16:28:13 -0500

On 29-Jan-2010, S ren Hauberg wrote:

| fre, 29 01 2010 kl. 21:56 +0100, skrev Jaroslav Hajek:
| > Incidentally, is anyone able to check a recent Matlab to find out what
| > is displayed by the command
| > [a, ~, b] = deal (1, 2, 3) % without semicolon
| > ?
| > Is the middle value displayed? If not, then I suppose we really should
| > simply omit the swallowed variables from the result. That's going to
| > be easy to implement as well.
| 
|         >> [a, ~, b] = deal (1, 2, 3) % without semicolon
|         ??? [a, ~, b] = deal (1, 2, 3) % without semicolon
|                  |
|         Error: Expression or statement is incorrect--possibly unbalanced
|         (, {, or [.
|          
| This is with R2009a. Is that too old a version?

Looking at the online docs, it appears to be new in 2009b.

They also allow ~ to be used to indicate unused input arguments.  I
guess that is marginally useful in some cases (they cite gui
callbacks, for one) because as I recall, Matlab will generate an error
if you have a function like this

  function foo (a)
    ...
  end

and then call it with extra arguments, like this:

  foo (1, 2)

I think Matlab automatically checks the number of declared inputs and
won't allow you to pass more than that.  Didn't we discuss this on the
list and decide not to implement that feature?

Oh, after writing all that, I see that Jaroslav has already made this
feature work too.

Thanks!

jwe


reply via email to

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