function s = setFromStruct( s, t, fn )
%s = setFromStruct( s, t, fn )
%   Set fields of S in the cellarray FN of field names to the
%   corresponding values of T.  FN is optional and defaults to the set of
%   all fields of T.  Other fields of s are left unchanged.

    if nargin < 3
        fn = fieldnames(t);
    end
    for i = 1:length(fn)
        s.(fn{i}) = t.(fn{i});
    end
end
