function opt = options (def_opt, opts)
%OPTIONS  Fill in default options.
%
%   OPTIONS(default_options, given_options) replaces the default
%   options (arguments) with the given ones. If NaN is given as an
%   option, the default value is used.

opt = def_opt;
if nargin > 1,
    opts = opts(1:min(length(def_opt), length(opts)));
    idx = find(~isnan(opts));
    opt(idx) = opts(idx);
end
