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: aas_emeg_plot_topographies.m
    path of file: ./repos/automaticanalysis/aa_engine
    
    the code of the file until where you have to start completion: function aas_emeg_plot_topographies(varargin)
% plot_topographies()

    
function aas_emeg_plot_topographies(varargin)
% plot_topographies()
% plot_topographies(D,movie,T,sensors,figstyle,layout,fulloutputfile,vector)
%
% Plot 2D projection of sensor data at selected time points, averaged
% across time-window, or as a movie. Various layout options. Plot
% either magnetometer signal, or power for gradiometer pairs.
%
% D can be structure or filename or cell array of these.
% movie  - 'off' or frame length in ms
% T - specific time (ms), or
%   - time window (ms) to average, or
%   - vector of snapshots
% sensors - 'Mags' , 'Grads' or 'EEG'
% figstyle - 'A4' or 'Screen'
% layout - 'subs x time'
%        - 'time x subs'
%        - 'subs x evts'
%        - 'evts x subs'
%        - 'evts x time'
%        - 'time x evts'
%        - 'subs x subs'
%        - 'time x time'
%        - 'evts x evts'
% fulloutputfile - full path of output file (ending will be
% changed to <sensors>_<event>.png/.ps for figure,
% or .avi for movie)
% vector - 0|1 flag to plot as image (bitmap) or surface (vector) respectively
%
% Danny Mitchell 20/01/08

% Could confirm files are correct
% Improve marking of sensor positions
% Would be nice to add contour plot of stats for group analysis
% Using cubic interpolation which is smoother and faster than default 
% linear interpolation, but seems to have lower contrast, probably due to smoothing.
% Use all sensors for mags or grads, and set bad eeg channels to zero.

load /imaging/dm01/MEG/aaMEG/redblue2_128
addpath /imaging/local/spm/spm5
addpath /imaging/local/spm/spm5/cbu_updates/

if length(varargin)>0; data=varargin{1};
else data=spm_select(Inf,'mat','Please select file(s) containing averaged waveforms','',pwd,'^.*m.*mat$');
end