function msfcn_times_two(block)
% Level-2 M file S-Function for times two demo.
%   Copyright 1990-2004 The MathWorks, Inc.
%   $Revision: 1.1.6.1 $ 

  setup(block);
  
%endfunction

function setup(block)
  
  %% Register number of input and output ports
  block.NumInputPorts  = 0;
  block.NumOutputPorts = 0;

  %% Setup functional port properties to dynamically
  %% inherited.
  block.SetPreCompInpPortInfoToDynamic;
  block.SetPreCompOutPortInfoToDynamic;
 
  % block.InputPort(1).DirectFeedthrough = true;
  
  %% Set block sample time to inherited
  block.SampleTimes = [-1 0];
  
  %% Run accelerator on TLC
  block.SetAccelRunOnTLC(true);
  
  %% Register methods
  block.RegBlockMethod('Outputs',@Output);  
  
%endfunction

function Output(block)

if block.CurrentTime < 3
   set_param('beispiel/Gain','Gain','1')
elseif block.CurrentTime < 7
   set_param('beispiel/Gain','Gain','5')
elseif block.CurrentTime < 10 
   set_param('beispiel/Gain','Gain','1')
end% if
  
%endfunction

