%% Apply Function to Fields of Structure
% Create a scalar structure with fields that contain numeric arrays of different sizes.

S.f1 = 1:10;
S.f2 = [2; 4; 6];
S.f3 = []

%
% Calculate the mean of each numeric array, and return the means in an array.

A = structfun(@mean,S)

% Copyright 2012 The MathWorks, Inc.