This rule applies to continuous-time charts because you cannot
call functions during minor time steps. You can call Simulink® functions
in state entry or exit actions
and transition actions. However, if you try to call Simulink functions
in state during actions or transition conditions,
an error message appears when you simulate your model.
If you select Execute (enter) Chart At Initialization in
the Chart properties dialog box, you cannot call Simulink functions
in default transitions that execute the first time that the chart
awakens. Otherwise, an error message appears when you simulate your
For Simulink functions inside a Stateflow chart, the
output ports do not support discontiguous signals. If your function
contains a block that outputs a discontiguous signal, insert a Signal
Conversion block between the discontiguous output and the
output port. This action ensures that the output signal is contiguous.
Blocks that can output a discontiguous signal include the Bus
Creator block and the Mux block. For the Bus
Creator block, the output is discontiguous only if you clear
the Output as nonvirtual bus check box —
that is, if the Bus Creator block outputs a virtual
bus. If you select Output as nonvirtual bus,
the output signal is contiguous and no conversion is necessary.
If you try to export Simulink functions, an error appears
when you simulate your model. To avoid this behavior, clear the Export
Chart Level Functions (Make Global) check box in the Chart
properties dialog box.