Skip to content

structfun

general · scripts/general/structfun.m

: a = structfun (fcn, s)
: a = structfun (…, "UniformOutput", tf)
: a = structfun (…, "ErrorHandler", efcn)
: [a1, …] = structfun (…)

Apply fcn to every field of the scalar structure s.

With uniform output (the default) each call must return one scalar of a common class and the results form a column vector. Otherwise the results are returned in a structure with the same field names. An error handler receives a structure with fields message, identifier and index, followed by the field value.