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: spm_make_contrasts.m
    path of file: ./repos/spm12
    
    the code of the file until where you have to start completion: function Con = spm_make_contrasts(k)
% Make contrasts for one, two or three-way ANOVAs
% FORMAT Con = spm_make_contrasts(k)
%
% k        - vector where the ith entry is the number of levels of factor i
%
% Con      - struct array with fields:
% Con(c).c    - Contrast matrix
%       .name - Name
%
% This function computes contrasts for a generic k(1)-by-k(2)-by-k(3)
% design. It is assumed that the levels of the first factor change slowest.
%
% For one-way ANOVAs set k=L, where L is the number of
% levels, for two-way ANOVAs set k=[L1 L2], for three way set k=[L1 L2 L3]
%
% This function generates (transposed) contrast matrices to test
% average effect, main effect of each factor and interactions.
%__________________________________________________________________________
%
% Reference:
%
% For details of Kronecker operations, see section 5 of
%     http://www.fil.ion.ucl.ac.uk/~wpenny/publications/rik_anova.pdf
%__________________________________________________________________________

    
function Con = spm_make_contrasts(k)
% Make contrasts for one, two or three-way ANOVAs
% FORMAT Con = spm_make_contrasts(k)
%
% k        - vector where the ith entry is the number of levels of factor i
%
% Con      - struct array with fields:
% Con(c).c    - Contrast matrix
%       .name - Name
%
% This function computes contrasts for a generic k(1)-by-k(2)-by-k(3)
% design. It is assumed that the levels of the first factor change slowest.
%
% For one-way ANOVAs set k=L, where L is the number of
% levels, for two-way ANOVAs set k=[L1 L2], for three way set k=[L1 L2 L3]
%
% This function generates (transposed) contrast matrices to test
% average effect, main effect of each factor and interactions.
%__________________________________________________________________________
%
% Reference:
%
% For details of Kronecker operations, see section 5 of
%     http://www.fil.ion.ucl.ac.uk/~wpenny/publications/rik_anova.pdf
%__________________________________________________________________________
% Copyright (C) 2005-2012 Wellcome Trust Centre for Neuroimaging

% Will Penny
% $Id: spm_make_contrasts.m 6157 2014-09-05 18:17:54Z guillaume $


%-Number of factors
%--------------------------------------------------------------------------
nf = numel(k);
k  = [k(:)' 1 1 1];

if nf > 3
    fprintf('spm_make_contrasts not written for %d-way ANOVAs.\n',nf);
    Con = [];
    return
end