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: apply_filter.m
    path of file: ./repos/bspm/thirdparty/spm12/toolbox/marsbar-0.44/@mardo_2
    
    the code of the file until where you have to start completion: function Y = apply_filter(D, Y, flags)
% applies filter in design to data
% FORMAT Y = apply_filter(D, Y, flags)
%

    
function Y = apply_filter(D, Y, flags)
% applies filter in design to data
% FORMAT Y = apply_filter(D, Y, flags)
%
% D      - design, which includes a filter
% Y      - data to filter (2D matrix or marsy data object)
% flags  - string specifying one option, or cell array specifying more
%          than one option, or struct with fields specifying options.
%          Values for strings, cell contents or field names are
%          'no_whitening'  - specifies not to use whitening matrix even
%                            if present in model
%          'sessions'      - when used as struct field, value for field
%                            specifies sessions to apply filter for. The
%                            data size must match the length of the
%                            included sessions.
%
% Returns
% Y      - filtered data
%
% $Id$
  
if nargin < 2
  error('Need data to filter');
end