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_steadystatesimulation.m
    path of file: ./repos/fieldtrip
    
    the code of the file until where you have to start completion: function [data] = ft_steadystatesimulation(cfg)

% FT_STEADYSTATESIMULATION creates a simulated EEG/MEG dataset. This function
% allows to simulate the effect of several independent stimulus trains. These can
% be presented as a periodic sequence, or as single (or few) transient stimuli.
% This function creates a single block of data. You can call it repeatedly and use
% FT_APPENDDATA to combine different blocks.
%
% Use as
%   data = ft_steadystatesimulation(cfg)
% where cfg is a configuration structure that should contain
%   cfg.fsample    = scalar, sampling frequency in Hz (default = 512)
%   cfg.duration   = scalar, trial length in seconds (default = 4.56)
%   cfg.baseline   = scalar, baseline length in seconds (default = 0)
%   cfg.ntrials    = integer N, number of trials (default = 320)
%   cfg.iti        = scalar, inter-trial interval in seconds (default = 1)
%   cfg.randomseed = 'yes' or a number or vector with the seed value (default = 'yes')
%
% Each trial can contain multiple nested experimental manipulations
%   cfg.level1.condition = scalar, or vector of length L1 (default = 1)
%   cfg.level1.gain      = scalar, or vector of length L1 (default = 1)
%   cfg.level2.condition = scalar, or vector of length L2 (default = 1)
%   cfg.level2.gain      = scalar, or vector of length L2 (default = 1)
%   cfg.level3.condition = scalar, or vector of length L3 (default = 1)
%   cfg.level3.gain      = scalar, or vector of length L3 (default = 1)
% If you don't need level 2 and up, specify the condition and gain as empty.
% Idem for level 3 and up.
%
% Stimuli are created at the lowest experimental level, and are modulated according to the product of the gain of all levels.
% Each trial can contain one or multiple stimuli.
% The behavior of each stimuli is specified with
%   cfg.stimulus1.mode = 'periodic', 'transient' or 'off' (default = 'periodic')
%   cfg.stimulus2.mode = 'periodic', 'transient' or 'off' (default = 'transient')
%
% If the stimulus is periodic (below as example for stimulus1), the following options apply
%   cfg.stimulus1.number          = does not apply for periodic stimuli
%   cfg.stimulus1.onset           = in seconds, first stimulus relative to the start of the trial (default = 0)
%   cfg.stimulus1.onsetjitter     = in seconds, max jitter that is added to the onset (default = 0)
%   cfg.stimulus1.isi             = in seconds, i.e. for 10Hz you would specify 0.1 seconds as the interstimulus interval (default = 0.1176)
%   cfg.stimulus1.isijitter       = in seconds, max jitter relative to the previous stimulus (default = 0)
%   cfg.stimulus2.condition       = does not apply for periodic stimuli
%   cfg.stimulus2.gain            = does not apply for periodic stimuli
%   cfg.stimulus1.kernelshape     = 'sine'
%   cfg.stimulus1.kernelduration  = in seconds (default = isi)
%
% If the stimulus is transient (below as example for stimulus2), the following options apply
%   cfg.stimulus2.number          = scalar M, how many transients are to be presented per trial (default = 4)
%   cfg.stimulus2.onset           = in seconds, first stimulus relative to the start of the trial (default = 0.7)
%   cfg.stimulus2.onsetjitter     = in seconds, max jitter that is added to the onset (default = 0.2)
%   cfg.stimulus2.isi             = in seconds as the interstimulus interval (default = 0.7)
%   cfg.stimulus2.isijitter       = in seconds, max jitter relative to the previous stimulus (default = 0.2)
%   cfg.stimulus2.condition       = 1xM vector with condition codes for each transient within a trial (default = [1 1 2 2])
%   cfg.stimulus2.gain            = 1xM vector with gain for each condition for each transient within a trial (default = [1 1 1 1])
%   cfg.stimulus2.kernelshape     = 'hanning'
%   cfg.stimulus2.kernelduration  = in seconds (default = 0.75*isi)
%
% RANDOMIZATIONS:
% - The onsetjitter is randomized between 0 and the value given, and is always added to the onset.
% - The isijitter is randomized between 0 and the value given, and is always added to the interstimulus interval (isi).
% - For periodic stimuli, which are constant within a trial, the condition code and gain are shuffled over all trials.
% - For transient stimuli, the condition code and gain are shuffled within each trial.
%
% Using the default settings, we model a peripherally presented flickering stimulus
% that appears at different excentricities together with a centrally presented
% transient stimulus that appears 4x per trial. To simulate the experiment described
% at , you have to call this 4 times with a different cfg.configuration and
% cfg.gain to model the task load and use FT_APPENDDATA to concatenate the trials. In
% this case cfg.condition models the factor "task load" (2 levels, low and high),
% cfg.stimulus1.condition models the factor "excentricity" (4 levels), and
% cfg.stimulation2.condition models the factor "stimulus type" (2 le
    
function creates a single block of data. You can call it repeatedly and use
% FT_APPENDDATA to combine different blocks.
%
% Use as
%   data = ft_steadystatesimulation(cfg)
% where cfg is a configuration structure that should contain
%   cfg.fsample    = scalar, sampling frequency in Hz (default = 512)
%   cfg.duration   = scalar, trial length in seconds (default = 4.56)
%   cfg.baseline   = scalar, baseline length in seconds (default = 0)
%   cfg.ntrials    = integer N, number of trials (default = 320)
%   cfg.iti        = scalar, inter-trial interval in seconds (default = 1)
%   cfg.randomseed = 'yes' or a number or vector with the seed value (default = 'yes')
%
% Each trial can contain multiple nested experimental manipulations
%   cfg.level1.condition = scalar, or vector of length L1 (default = 1)
%   cfg.level1.gain      = scalar, or vector of length L1 (default = 1)
%   cfg.level2.condition = scalar, or vector of length L2 (default = 1)
%   cfg.level2.gain      = scalar, or vector of length L2 (default = 1)
%   cfg.level3.condition = scalar, or vector of length L3 (default = 1)
%   cfg.level3.gain      = scalar, or vector of length L3 (default = 1)
% If you don't need level 2 and up, specify the condition and gain as empty.
% Idem for level 3 and up.
%
% Stimuli are created at the lowest experimental level, and are modulated according to the product of the gain of all levels.
% Each trial can contain one or multiple stimuli.
% The behavior of each stimuli is specified with
%   cfg.stimulus1.mode = 'periodic', 'transient' or 'off' (default = 'periodic')
%   cfg.stimulus2.mode = 'periodic', 'transient' or 'off' (default = 'transient')
%
% If the stimulus is periodic (below as example for stimulus1), the following options apply
%   cfg.stimulus1.number          = does not apply for periodic stimuli
%   cfg.stimulus1.onset           = in seconds, first stimulus relative to the start of the trial (default = 0)
%   cfg.stimulus1.onsetjitter     = in seconds, max jitter that is added to the onset (default = 0)
%   cfg.stimulus1.isi             = in seconds, i.e. for 10Hz you would specify 0.1 seconds as the interstimulus interval (default = 0.1176)
%   cfg.stimulus1.isijitter       = in seconds, max jitter relative to the previous stimulus (default = 0)
%   cfg.stimulus2.condition       = does not apply for periodic stimuli
%   cfg.stimulus2.gain            = does not apply for periodic stimuli
%   cfg.stimulus1.kernelshape     = 'sine'
%   cfg.stimulus1.kernelduration  = in seconds (default = isi)
%
% If the stimulus is transient (below as example for stimulus2), the following options apply
%   cfg.stimulus2.number          = scalar M, how many transients are to be presented per trial (default = 4)
%   cfg.stimulus2.onset           = in seconds, first stimulus relative to the start of the trial (default = 0.7)
%   cfg.stimulus2.onsetjitter     = in seconds, max jitter that is added to the onset (default = 0.2)
%   cfg.stimulus2.isi             = in seconds as the interstimulus interval (default = 0.7)
%   cfg.stimulus2.isijitter       = in seconds, max jitter relative to the previous stimulus (default = 0.2)
%   cfg.stimulus2.condition       = 1xM vector with condition codes for each transient within a trial (default = [1 1 2 2])
%   cfg.stimulus2.gain            = 1xM vector with gain for each condition for each transient within a trial (default = [1 1 1 1])
%   cfg.stimulus2.kernelshape     = 'hanning'
%   cfg.stimulus2.kernelduration  = in seconds (default = 0.75*isi)
%
% RANDOMIZATIONS:
% - The onsetjitter is randomized between 0 and the value given, and is always added to the onset.
% - The isijitter is randomized between 0 and the value given, and is always added to the interstimulus interval (isi).
% - For periodic stimuli, which are constant within a trial, the condition code and gain are shuffled over all trials.
% - For transient stimuli, the condition code and gain are shuffled within each trial.
%
% Using the default settings, we model a peripherally presented flickering stimulus
% that appears at different excentricities together with a centrally presented
% transient stimulus that appears 4x per trial. To simulate the experiment described
% at , you have to call this 4 times with a different cfg.configuration and
% cfg.gain to model the task load and use FT_APPENDDATA to concatenate the trials. In
% this case cfg.condition models the factor "task load" (2 levels, low and high),
% cfg.stimulus1.condition models the factor "excentricity" (4 levels), and
% cfg.stimulation2.condition models the factor "stimulus type" (2 levels, non-target
% or target).
%
% See also FT_DIPOLESIMULATION, FT_TIMELOCKSIMULATION, FT_FREQSIMULATION,
% FT_CONNECTIVITYSIMULATION, FT_APPENDDATA

% Copyright (C) 2017, Stefan Wiens, Malina Szychowska, Robert Oostenveld
%
% 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$

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% the initial part deals with parsing the input options and data
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% these are used by the ft_preamble/ft_postamble function and scripts
ft_revision = '$Id$';
ft_nargin   = nargin;
ft_nargout  = nargout;

% do the general setup of the function
ft_defaults
ft_preamble init
ft_preamble debug
ft_preamble provenance
ft_preamble randomseed

% the ft_abort variable is set to true or false in ft_preamble_init
if ft_abort
  % do not continue function execution in case the outputfile is present and the user indicated to keep it
  return
end