You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: set_contrasts.m
    path of file: ./repos/bspm/thirdparty/spm12/toolbox/marsbar-0.44/@mardo
    
    the code of the file until where you have to start completion: function D = set_contrasts(D, C, refreshf)
% method to set contrasts into design object
%

    
function D = set_contrasts(D, C, refreshf)
% method to set contrasts into design object
%
% D     - design
% C     - contrasts
%           C can be a contrast structure, or a structure containing
%           a contrast structure
% refreshf - if 1 then refresh contrasts with respect to design matrix
%            structures in `D`. Default is 1
%
% Returns
% D     - design with contrasts set to C
%
% $Id$

if nargin < 2
  error('Need contrasts');
end