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: ContrastTest.m
    path of file: ./repos/fieldtrip/external/afni
    
    the code of the file until where you have to start completion: function [err,contrfile] = ContrastTest (N_runs, polort, N_basis, Task, N_tasks, N_contr, El, N_base)
%
%   [err,] = ContrastTest ()
%
%Purpose:
%   Construct the contrast test matrix used in -glt option of 3dDeconvolve.

    
function [err,contrfile] = ContrastTest (N_runs, polort, N_basis, Task, N_tasks, N_contr, El, N_base)
%
%   [err,] = ContrastTest ()
%
%Purpose:
%   Construct the contrast test matrix used in -glt option of 3dDeconvolve.
%
%
%Input Parameters:
%
%
%
%Output Parameters:
%   err : 0 No Problem
%       : 1  Problems
%
%
%
%Key Terms:
%
%More Info :
%
%
%
%
%     Author : Gang Chen
%     Date : Tue Jul 29 13:01:05 EDT 2003
%     SSCC/NIMH/ National Institutes of Health, Bethesda Maryland


%Define the function name for easy referencing
FuncName = 'ContrastTest';

%Debug Flag
DBG = 1;

%initailize return variables
err = 1;

%Create a matrix so that 3dDeconvolve uses for regressor test.

length = (polort+1)*N_runs+N_base;
for (iT = 1:1:N_tasks),
   for (j = 1:1:N_basis)    ,
	   length = length + (Task(iT).BasisOpt_struct(j).maxlag - Task(iT).BasisOpt_struct(j).minlag + 1);
	end