help-octave
[Top][All Lists]
Advanced

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

RE: Synonym


From: Richardson, Anthony
Subject: RE: Synonym
Date: Wed, 8 Apr 2020 12:28:15 +0000

 

From: Doug Stewart
To: Ian McCallion <address@hidden>
Cc: Help GNU Octave <address@hidden>
Subject: Re: Synonym

 

>> On Wed, Apr 8, 2020 at 7:35 AM Ian McCallion <address@hidden> 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

>> 

>> Cheers... Ian

>> 

> this seems to work!

>
> function [varargout2] = short(varargin)
>       varargout = verylongname(varargin{:})
>       varargout2=varargout(:)
>    endfunction
>

> 

> --

> DAS

 

Doug,

I could not get that to work when multiple output arguments are requested.  My attempt is below.  It’s kind of ugly, maybe someone can come up with a nicer method.

 

Tony

 

function varargout = short(varargin)

  usv = nthargout ([1:nargout()], @short, varargin{:});

   if isa(usv, "cell")

      for i = 1:nargout

        varargout{i} = usv{i};

      endfor

    else

      varargout{1} = usv;

    endif 

endfunction

 

 

 

 

 

 


reply via email to

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