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: bcifun_latidx.m
    path of file: ./repos/fieldtrip/realtime/example
    
    the code of the file until where you have to start completion: function cmd = bcifun_latidx(cfg,data)

% BCIFUN_LATIDX extracts alpha power, computes the alpha lateralization index 
% and sends a command to an external device
%
% This function computes the lateralization index log(A/B) for the
% average alpha power in right channels A and the average alpha power
% in left channels B. In a covert attention experiment we expect
% higher values for attention to the right visual hemifield and lower
% values for attention to the left visual hemifield.

% Copyright (C) 2009, Marcel van Gerven
%
% 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 
    
function computes the lateralization index log(A/B) for the
% average alpha power in right channels A and the average alpha power
% in left channels B. In a covert attention experiment we expect
% higher values for attention to the right visual hemifield and lower
% values for attention to the left visual hemifield.

% Copyright (C) 2009, Marcel van Gerven
%
% 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$

persistent idx;
persistent alis;

if isempty(idx)
    idx = 1; 
    alis = zeros(1,100);
end