annotate general/funutils/returns.m @ 61:eff6bddf82e3 tip

Finally implemented perceptual brightness thing.
author samer
date Sun, 11 Oct 2015 10:20:42 +0100
parents fbc0540a9208
children
rev   line source
samer@9 1 function Y=returns(I,F,varargin)
samer@9 2 % returns - Evaluate function and return multiple values in cell array
samer@4 3 %
samer@9 4 % returns ::
samer@9 5 % I:[[M]->[N]] ~'M numbers between 1 and N',
samer@9 6 % (A(1),...,A(L) -> B(1), ..., B(N)) ~'function with L in and N outputs',
samer@9 7 % A(1), ..., A(L) ~'arguments for function'
samer@9 8 % -> cell { B(I(1)), ..., B(I(M)) } ~'selected returns in a cell array'.
samer@4 9
samer@4 10 Z=cell(max(I),1);
samer@4 11 [Z{:}]=F(varargin{:});
samer@4 12 Y=Z(I);