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: browse_simpleFFT.m
    path of file: ./repos/bspm/thirdparty/spm12/external/fieldtrip/private
    
    the code of the file until where you have to start completion: function browse_simpleFFT(cfg, data)

% BROWSE_SIMPLEFFT is a helper function for FT_DATABROWSER that shows a
% simple FFT of the data.
%
% Included are a button to switch between log and non-log space, and a
% selection button to deselect channels, for the purpose of zooming in on
% bad channels.
%
% See also BROWSE_MOVIEPLOTER, BROWSE_TOPOPLOTER, BROWSE_MULTIPLOTER, BROWSE_TOPOPLOTVAR, BROWSE_SIMPLEFFT

% Copyright (C) 2011-2014, Roemer van der Meij

% call ft_freqanalysis on data
cfgfreq = [];
cfgfreq.method = 'mtmfft';
cfgfreq.taper = 'boxcar';
freqdata = ft_freqanalysis(cfgfreq, data);

% remove zero-bin for plotting
if freqdata.freq(1) == 0
  freqdata.freq = freqdata.freq(2:end);
  freqdata.powspctrm = freqdata.powspctrm(:, 2:end);
end

%%% FIXME: it wou
    
function togglex(h, eventdata)
ffth = get(h, 'parent');
fftopt = getappdata(ffth, 'fftopt');
fftopt.semilogx = ~fftopt.semilogx;
setappdata(ffth, 'fftopt', fftopt);
draw_simple_fft_cb(h)

function toggley(h, eventdata)
ffth = get(h, 'parent');
fftopt = getappdata(ffth, 'fftopt');
fftopt.semilogy = ~fftopt.semilogy;
setappdata(ffth, 'fftopt', fftopt);
draw_simple_fft_cb(h)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% SUBFUNCTION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function selectchan_fft_cb(h, eventdata)
ffth = get(h, 'parent');
fftopt = getappdata(ffth, 'fftopt');

% open chansel dialog
chansel = select_channel_list(fftopt.freqdata.label, fftopt.chansel, 'select channels for viewing power');

% output data
fftopt.chansel = chansel;
setappdata(ffth, 'fftopt', fftopt);
draw_simple_fft_cb(h)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% SUBFUNCTION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function draw_simple_fft_cb(h, eventdata)
ffth = get(h, 'parent');
fftopt = getappdata(ffth, 'fftopt');
% clear axis (for switching)
cla

% toggle log10 or not
if fftopt.semilogx
  freq = log10(fftopt.freqdata.freq);
else
  freq = fftopt.freqdata.freq;
end