To model complex logic in a Simulink® model, consider using Stateflow® software.
Stateflow extends Simulink with a design environment for developing state transition diagrams and flow charts. Stateflow provides the language elements required to describe complex logic in a natural, readable, and understandable form. It is tightly integrated with MATLAB® and Simulink products, providing an efficient environment for designing embedded systems that contain control, supervisory, and mode logic.
For more information on Stateflow software, see Stateflow.