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: good_channel.m
    path of file: ./repos/brainstorm3/toolbox/sensors
    
    the code of the file until where you have to start completion: function iChannelFinal = good_channel(Channel, ChannelFlag, channelTypes)
% GOOD_CHANNEL: Extract channels of a given type.
%
% USAGE: iChannel = good_channel(Channel, ChannelFlag, channelTypes);
%        iChannel = good_channel(Channel, [], channelType);
%
% INPUT:
%    - Channel     : Brainstorm Channel.mat structure, of importance here is Channel.Type

    
function iChannelFinal = good_channel(Channel, ChannelFlag, channelTypes)
% GOOD_CHANNEL: Extract channels of a given type.
%
% USAGE: iChannel = good_channel(Channel, ChannelFlag, channelTypes);
%        iChannel = good_channel(Channel, [], channelType);
%
% INPUT:
%    - Channel     : Brainstorm Channel.mat structure, of importance here is Channel.Type
%    - ChannelFlag : vector of -1 (bad), 0(indifferent), and 1(good) data flags of length 
%                    the number of channels in the Channel structure.
%                    If left empty, assumes all channels are GOOD
%    - channelTypes: Types of channel that is looked for ('EEG', 'MEG', ...)
%
% OUTPUT:
%    - iChannel : the index to the good channels for desired sensor type 

% @=============================================================================
% This function is part of the Brainstorm software:
% https://neuroimage.usc.edu/brainstorm
% 
% Copyright (c) University of Southern California & McGill University
% This software is distributed under the terms of the GNU General Public License
% as published by the Free Software Foundation. Further details on the GPLv3
% license can be found at http://www.gnu.org/copyleft/gpl.html.
% 
% FOR RESEARCH PURPOSES ONLY. THE SOFTWARE IS PROVIDED "AS IS," AND THE
% UNIVERSITY OF SOUTHERN CALIFORNIA AND ITS COLLABORATORS DO NOT MAKE ANY
% WARRANTY, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO WARRANTIES OF
% MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, NOR DO THEY ASSUME ANY
% LIABILITY OR RESPONSIBILITY FOR THE USE OF THIS SOFTWARE.
%
% For more information type "brainstorm license" at command prompt.
% =============================================================================@
%
% Authors: Sylvain Baillet, John C. Mosher, January 1999
%          Francois Tadel, 2008-2010

iChannelFinal = [];
if isempty(channelTypes)
    return;
elseif ~iscell(channelTypes)
    channelTypes = {channelTypes};
end