help-octave
[Top][All Lists]
Advanced

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

Re: Synonym


From: John W. Eaton
Subject: Re: Synonym
Date: Wed, 8 Apr 2020 09:20:01 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0

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.

jwe



reply via email to

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