Code covered by the BSD License    Highlights from  image
thumbnail     11 Aug 2010 (Updated )   function
lorenz_graphs(block) % The goal of this code is to make the
S-function behave like a Simulink % block. During simulation of
a model, the Simulink engine invokes this function at different
times during the simulation % Initialization step, update and
output steps and the subfunctions % corresponding to them get
invoked in that same order. The initialization function gets
invoked only once at the beginning of the  % simulation. Update
and output functions get invoked at every time step (major &
minor). Also, observe that the level-2 % S-Function has a lot of
similarity with C S-Function that the Level-1 % S-Function.
function setup(block)         % We setup and register callback
methods that are directly called during simulation.         %
Number of input ports and dimensionality         % (1) indicates
the output port number-change it to add multiple ports.
% Also do bookkeeping of these ports