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: ft_checkdata.m
    path of file: ./repos/bspm/thirdparty/spm12/external/fieldtrip/utilities
    
    the code of the file until where you have to start completion: function [data] = ft_checkdata(data, varargin)

% FT_CHECKDATA checks the input data of the main FieldTrip functions, e.g. whether the
% type of data strucure corresponds with the required data. If neccessary and poss
    
function requires MEG data with a ''grad'' field');
  elseif ~okflag && isequal(ismeg, 'no')
    ft_error('This function should not be given MEG data with a ''grad'' field');
  end % if okflag
end

if ~isempty(iseeg)
  if isequal(iseeg, 'yes')
    okflag = isfield(data, 'grad');
  elseif isequal(iseeg, 'no')
    okflag = ~isfield(data, 'grad');
  end