%% Matrix Input and Output
%
% The example shows the ability of Stateflow(R) to accept matrix input
% signals from Simulink(R) and also output matrix signals to Simulink. In this
% particular example, we are multiplying a [2x2] matrix with another [2x2]
% matrix to obtain a [2x2] output matrix. A flow chart is used to perform the
% calculations which is also the reason why the length of the simulation time
% is only one timestep.
% 
% The graphical flowchart is equivalent to writing the following nested-loop
% in the C language:
% 
% for(i=0; i<2; i++) { for(j=0; j<2; j++) { int final_out[2][2];
%     final_out[i][j] = (data1[i][0] * data2[0][j]) + (data1[i][1] +
%     data2[1][j]); } }
% 
% 'final_out' is the Stateflow output signal in this example. 

% Copyright 2006-2012 The MathWorks, Inc.

% modify this to play around with the formatting of the example
mdl = 'sf_matrix';
open_system(mdl);
evalc('sim(mdl)');
