Apply function to each field of scalar structure
applies the function A = structfun(func,S)func to each field of scalar structure
S, one field at a time. structfun then
concatenates the outputs from func into the column vector
A. The input argument func is a function
handle to a function that takes one input argument and returns a scalar. The output
from func can have any data type, so long as objects of that type
can be concatenated. The number of elements in A equals the
number of fields in S.
You cannot specify the order in which structfun calculates the
elements of A or rely on them being done in any particular
order.
applies A = structfun(func,S,Name,Value)func with additional options specified by one or more
Name,Value pair arguments. For example, to return output
values in a structure, specify 'UniformOutput',false. You can
return A as a structure when func returns
values that cannot be concatenated into an array. The returned structure has the
same fields as S.
[A1,...,Am] = structfun(___) returns multiple
output arrays A1,...,Am when func returns
m output values. func can return output
arguments that have different data types, but the data type of each output must be
the same each time func is called. You can use this syntax with
any of the input arguments of the previous syntaxes.
arrayfun | cell2mat | cellfun | spfun | splitapply