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

% FT_CONNECTIVITY_POWCORR_ORTHO computes power correlation after removing
% the zero-lag contribution on a trial-by-trial basis, according to Hipp's
% Nature Neuroscience paper. 
%
% Use as
%   c = ft_connectivity_powcorr(mom)
%   c = ft_connectivity_powcorr(mom, 'refindx', refindx)
%
% Where mom is a NchanxNrpt matrix containing the complex-valued amplitude
% and phase information at a given frequency, and the optional key refindx
% specifies the index/indices of the channels that serve as a reference 
% channel. (Default is 'all').
%
% The output c is a NchanxNrefchan matrix that contain the power correlation
% for all channels orthogonalised relative to the reference channel in the first
% Nrefchan columns, and the power correlation for the reference channels 
% orthogonalised relative to the channels in the second Nrefchan columns.

% Copyright (C) 2012 Jan-Mathijs Schoffelen
%
% This file is part of FieldTrip, see http://www.fieldtriptoolbox.org
% for the documentation and details.
%
%    FieldTrip is free software: you can redistribute it and/or modify
%    it under the terms of the GNU General Public License as published by
%    the Free Software Foundation, either version 3 of the License, or
%    (at your option) any later version.
%
%    FieldTrip is distributed in the hope that it will be useful,
%    but WITHOUT ANY WARRANTY; without even the implied warranty of
%    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

    
function [c] = ft_connectivity_powcorr_ortho(mom, varargin)

% FT_CONNECTIVITY_POWCORR_ORTHO computes power correlation after removing
% the zero-lag contribution on a trial-by-trial basis, according to Hipp's
% Nature Neuroscience paper. 
%
% Use as
%   c = ft_connectivity_powcorr(mom)
%   c = ft_connectivity_powcorr(mom, 'refindx', refindx)
%
% Where mom is a NchanxNrpt matrix containing the complex-valued amplitude
% and phase information at a given frequency, and the optional key refindx
% specifies the index/indices of the channels that serve as a reference 
% channel. (Default is 'all').
%
% The output c is a NchanxNrefchan matrix that contain the power correlation
% for all channels orthogonalised relative to the reference channel in the first
% Nrefchan columns, and the power correlation for the reference channels 
% orthogonalised relative to the channels in the second Nrefchan columns.

% Copyright (C) 2012 Jan-Mathijs Schoffelen
%
% This file is part of FieldTrip, see http://www.fieldtriptoolbox.org
% for the documentation and details.
%
%    FieldTrip is free software: you can redistribute it and/or modify
%    it under the terms of the GNU General Public License as published by
%    the Free Software Foundation, either version 3 of the License, or
%    (at your option) any later version.
%
%    FieldTrip is distributed in the hope that it will be useful,
%    but WITHOUT ANY WARRANTY; without even the implied warranty of
%    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%    GNU General Public License for more details.
%
%    You should have received a copy of the GNU General Public License
%    along with FieldTrip. If not, see <http://www.gnu.org/licenses/>.
%
% $Id$

refindx = ft_getopt(varargin, 'refindx', 'all');
tapvec  = ft_getopt(varargin, 'tapvec',  ones(1,size(mom,2)));

if strcmp(refindx, 'all')
  refindx = 1:size(mom,1);
end