Skip to content

cellfun

builtin · libnexusinterp/corefcn/cellfun-proprietary.cc

: A = cellfun (fcn, C)
: A = cellfun (fcn, C1, C2, …)
: [A, …] = cellfun (…)
: cellfun (…, "UniformOutput", tf)
: cellfun (…, "ErrorHandler", handler)

Apply a function to every element of one or more cell arrays.

fcn is a function handle or function name; it is called as fcn (C1{k}, C2{k}, …) for each element. The cell arrays must have the same size.

With the default "UniformOutput" true every call must return a scalar and the results form an array of the size of C with the class of the returned values. With "UniformOutput" false the results are collected in cell arrays.

If a call fails and an "ErrorHandler" is given, the handler is called with a structure having the fields message, identifier and index followed by the original arguments, and its results replace those of fcn.

The strings "isempty", "islogical", "isnumeric", "isreal", "length", "ndims", "prodofsize", "isclass" and "size" select fast built-in tests.