|
From: | Richardson, Anthony |
Subject: | RE: Synonym |
Date: | Wed, 8 Apr 2020 12:28:15 +0000 |
From: Doug Stewart >> 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! > > > -- > 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 |
[Prev in Thread] | Current Thread | [Next in Thread] |