Code covered by the BSD License  

Highlights from
objfun

objfun

by

 

Apply a function to each object of an object array.

objfun (fun, x, varargin)
function varargout = objfun (fun, x, varargin)
% OBJFUN Apply a function to each object of an object array.
%
% See CELLFUN
%
% Note: Since objfun uses cellfun, arguments to the function must be 
%       provided in a cell.

varargout = cell (1, max (1, nargout));
[varargout{:}] = cellfun(fun, ...
                         mat2cell(x,...
                                  ones(1,size(x,1)),...
                                  ones(1,size(x,2))), ...
                         varargin{:});

if nargout == 0
    clear varargout;
end

Contact us