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_dem_mdp_movie.m
    path of file: ./repos/spm12/toolbox/DEM
    
    the code of the file until where you have to start completion: function spm_dem_mdp_movie(DEM)
% creates a movie of visual search in extrinsic and intrinsic coordinates
% FORMAT spm_dem_mdp_movie(DEM)
%
% DEM - {DEM} structures from visual search simulations
%
% hidden causes and states
%==========================================================================
% x    - hidden states:
%   x(1) - oculomotor angle
%   x(2) - oculomotor angle
% v    - hidden causes
%   v(1) - location of object
%   v(2) - location of object
%   v(3) - relative amplitude of visual hypothesis 1...
%
% g    - sensations:
%   g(1) - oculomotor angle (proprioception - x)
%   g(2) - oculomotor angle (proprioception - y)
%   g(3) - retinal input - channel 1
%   g(4) - retinal input - channel 2
%   g(5) - ...
%__________________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging

% Karl Friston
% $Id: spm_dem_mdp_movie.m 6901 2016-10-08 13:21:41Z karl $


% Preliminaries
%--------------------------------------------------------------------------
clf, global STIM
if ~isfield(STIM,'W'), STIM.W = 1/6; end
if ~isfield(STIM,'B'), STIM.B = 1;   end
B   = STIM.B;
W   = STIM.W;
R   = STIM.R;


    
function spm_dem_mdp_movie(DEM)
% creates a movie of visual search in extrinsic and intrinsic coordinates
% FORMAT spm_dem_mdp_movie(DEM)
%
% DEM - {DEM} structures from visual search simulations
%
% hidden causes and states
%==========================================================================
% x    - hidden states:
%   x(1) - oculomotor angle
%   x(2) - oculomotor angle
% v    - hidden causes
%   v(1) - location of object
%   v(2) - location of object
%   v(3) - relative amplitude of visual hypothesis 1...
%
% g    - sensations:
%   g(1) - oculomotor angle (proprioception - x)
%   g(2) - oculomotor angle (proprioception - y)
%   g(3) - retinal input - channel 1
%   g(4) - retinal input - channel 2
%   g(5) - ...
%__________________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging

% Karl Friston
% $Id: spm_dem_mdp_movie.m 6901 2016-10-08 13:21:41Z karl $


% Preliminaries
%--------------------------------------------------------------------------
clf, global STIM
if ~isfield(STIM,'W'), STIM.W = 1/6; end
if ~isfield(STIM,'B'), STIM.B = 1;   end
B   = STIM.B;
W   = STIM.W;
R   = STIM.R;


% Stimulus
%==========================================================================
N     = length(DEM);
a     = [];
for j = 1:numel(DEM(1).X)
    X{j} = [];
end