help-octave
[Top][All Lists]
Advanced

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

Re: Synonym


From: Ian McCallion
Subject: Re: Synonym
Date: Wed, 8 Apr 2020 14:26:57 +0100

On Wed, 8 Apr 2020 at 14:20, John W. Eaton <address@hidden> wrote:
On 4/8/20 7:35 AM, Ian McCallion wrote:
> What is the right syntax for providing a function which does nothing
> except call another function with the same parameters and returns the
> same values back.
>
> The function below passes the parameters through, but getting returned
> values back does not work. I've tried various incantations without success
>
>     function [varargout] = short(varargin)
>         varargout = verylongame(varargin){:})
>      endfunction

Try

   function varargout = short (varargin)
     varargout = cell (nargout, 1);
     [varargout{:}] = verylongname (varargin{:});
   endfunction

Then verylongname will see the same value for nargout that short does
when it is called.  There are some forwarding functions like this in
Octave.  For example, bar.m and barh.m both forward to an internal
function private/__bar__.m.

Magic, thank you!!  I KNEW there should have been an appropriate syntax, but it had not occurred to me to initialise varargout to an appropriate sized cell array first.

Cheers... Ian



reply via email to

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