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: MatAFNI_Demo.m
    path of file: ./repos/fieldtrip/external/afni
    
    the code of the file until where you have to start completion: %script MatAFNI_Demo
%
%
%
%Purpose:
%   Demonstrate the use of the matlab AFNI library
%   The script is echoed onto the screen but it is best
%   you read through it with a text editor.
%
%
%Input:
%   You must have the data sets
%   ARzs_CW_avvr+orig, ARzs_CW_avvr.DEL+orig and ARzsspgrax+orig
%   in the working directory
%
%Output:
%
%
%
%
%
%Key Terms:
%
%More Info :
%
%
%
%
%     Author : Ziad Saad
%     Date : Tue Aug 28 16:21:54 PDT 2001
%     SSCC/NIMH/ National Institutes of Health, Bethesda Maryland

echo on

clear all

%check for data sets before proceeding
	if (exist('ARzs_CW_avvr+orig.HEAD') ~= 2 | exist('ARzs_CW_avvr+orig.BRIK') ~= 2),
		fprintf ('\nERROR: Missing ARzs_CW_avvr+orig data.\nCtrl+c to Abort.\n');
		while (1),
			pause;
		end
	end

	if (exist('ARzs_CW_avvr.DEL+orig.HEAD') ~= 2 | exist('ARzs_CW_avv
    
function WriteBrik and BrikInfo
	InfoDelOut.RootName = ''; %that'll get set by WriteBrik
	InfoDelOut.DATASET_RANK(2) = 2; %two sub-bricks
	InfoDelOut.BRICK_TYPES = [1 1]; %store data as shorts
	InfoDelOut.BRICK_STATS = []; %automatically set
	InfoDelOut.BRICK_FLOAT_FACS = [];%automatically set
	InfoDelOut.BRICK_LABS = 'Masked Delay~Masked Cross Correlation';
	InfoDelOut.IDCODE_STRING = '';%automatically set
	InfoDelOut.BRICK_STATAUX = [1 2 3 160 2 2];
	
	OptDelOut.Scale = 1;
	OptDelOut.Prefix = 'Demo1_func';
	OptDelOut.verbose = 0;

	!rm Demo1_func*

	%To write the two sub-bricks, I placed them in an Nx2 matrix [Vdel(:) Vxcor(:)]
%     sizes = size([Vdel(:) Vxcor(:)]);
%     M = zeros(1, sizes(1), sizes(2));
%     M(1,:,:) = [Vdel(:) Vxcor(:)];

        InfoDelOut.DATASET_DIMENSIONS = [64 64 18]; %size([Vdel(:) Vxcor(:)]);
        OptDelOut.AdjustHeader = 'x';
	[err, ErrMessage, InfoDelOut] = WriteBrik([Vdel(:) Vxcor(:)], InfoDelOut, OptDelOut);

	if (err),
		errordlg(sprintf('%s\nAbort now (ctrl+c).', ErrMessage));
		while (1),
			pause;
		end