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: prefix_images.m
    path of file: ./repos/malini/Codes/deconvolution - model/spm8/marsbar-0.44/@mardo
    
    the code of the file until where you have to start completion: function D = prefix_images(D, action, prefix, flags)
% method for adding or removing prefix from file names in design
% FORMAT D = prefix_images(D, action, prefix)
%

    
function D = prefix_images(D, action, prefix, flags)
% method for adding or removing prefix from file names in design
% FORMAT D = prefix_images(D, action, prefix)
%
% D          - mardo design
% action     - one of 'add' or 'remove'
% prefix     - prefix to remove
% flags      - optional struct containing none or more of fields
%              'check_exist' - one of 'warn', 'error', 'none'
%                      If not 'none' checks images exist with new
%                      filenames
%              'check_all'   - if not 0, checks all images, instead of
%                              the first image in the image list
%              'check_swap'  - if not 0, checks if images with new
%                      filenames need byte swapping, and swaps if so
%             
% $Id$
  
def_flags = struct('check_exist', 'none', ...
		   'check_all',   1, ...
		   'check_swap',  0);
  
if nargin < 2
  action = 'remove';
end