function Y=feval2cell(I,F,varargin)
% feval2cell - Evaluate function and return multiple values in cell array
%
% Usage:
%
% if F is a function that returns M >= max(I) values, then
%    Y = feval2cell(I,F,...)
% evaluates [Z{1:max(I)}]=F(...)
% and returns Z(I).

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