function result=cosmo_parcellfun(nproc,func,arg_cell,varargin)
% applies a function to elements in a cell in parallel
%
% result=cosmo_parcellfun(nproc,func,arg_cell,...)
%
% Inputs:
% nproc Maximum number of processes to run in parallel
% func Function handle that takes a single input
% argument and gives a single output
% arg_cell Cell with arguments to be given to func
% 'UniformOutput',o_u If false, then the output is converted to a
% numeric or logical array. Default: true
%
% Output:
% result Cell with the same size as arg_cell, with
% result{i}=func(arg_cell{i})
% If o_u is true, then result is converted to a
% numeric or logical array, assuming that each
% output is a scalar. If any output is not a
% scalar while o_u is true, an exception is
% thrown.
%