view general/funutils/returns.m @ 12:fbc0540a9208

Moved some high-order functions from funutils to arrutils, updated docs and cleaned up funutils.
author samer
date Mon, 14 Jan 2013 22:21:11 +0000
parents general/funutils/feval2cell.m@45aaf9b2d7b0
children
line wrap: on
line source
function Y=returns(I,F,varargin)
% returns - Evaluate function and return multiple values in cell array
%
% returns ::
%    I:[[M]->[N]]                       ~'M numbers between 1 and N',
%    (A(1),...,A(L) -> B(1), ..., B(N)) ~'function with L in and N outputs',
%    A(1), ..., A(L)                    ~'arguments for function'
% -> cell { B(I(1)), ..., B(I(M)) }     ~'selected returns in a cell array'.

Z=cell(max(I),1);
[Z{:}]=F(varargin{:});
Y=Z(I);