% output = mergeOptions(default, user, name)
% Merge a default options struct with a user-defined options struct. Works
% recursively, and will issue warning messages if the user attempts to
% define a field that is not in the default options.
% - All fields in DEFAULT will be present in OUTPUT
% - If a field is in both DEFAULT and USER, then the value from USER is
% present in OUTPUT
% - If a field is present in USER, but not DEFAULT, then issue a warning.
% - Applies recursively
% The argument NAME is optional, and contains a string specifying the
% name of the options struct. This is primarily used for printing
% warnings to the user.
% This function works recursively. For example, if there is a struct
% inside of a struct, then it will recursively apply this merge.
Bug Fix: old version was not properly overwriting default values in sub-structs.
Inspired: Particle Swarm Optimization