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_eeg_modality_ui.m
    path of file: ./repos/bspm/thirdparty/spm12
    
    the code of the file until where you have to start completion: function [mod, chanind]  = spm_eeg_modality_ui(D, scalp, planar)
% Attempts to determine the main modality of an MEEG object.
% If confused, asks the user.
%
% FORMAT [mod, chanind]  = spm_eeg_modality_ui(D, scalp, planar)
%
% D          - MEEG object
% scalp      - only look at scalp modalities [default: false]
% planar     - distinguish between MEG planar and other MEG types [default: false]
%
% modality   - the chosen modality
% chanind    - indices of the corresponding channels
%__________________________________________________________________________

    
function [mod, chanind]  = spm_eeg_modality_ui(D, scalp, planar)
% Attempts to determine the main modality of an MEEG object.
% If confused, asks the user.
%
% FORMAT [mod, chanind]  = spm_eeg_modality_ui(D, scalp, planar)
%
% D          - MEEG object
% scalp      - only look at scalp modalities [default: false]
% planar     - distinguish between MEG planar and other MEG types [default: false]
%
% modality   - the chosen modality
% chanind    - indices of the corresponding channels
%__________________________________________________________________________
% Copyright (C) 2008-2012 Wellcome Trust Centre for Neuroimaging

% Vladimir Litvak
% $Id: spm_eeg_modality_ui.m 5171 2013-01-03 15:52:31Z vladimir $

if nargin == 1
    scalp = false;
elseif nargin == 2
    planar = false;
end