MATLAB: Do I get an error when trying to use a Model block connected to a Merge block when the referenced model contains a Stateflow chart, Stateflow truth table, or Embedded MATLAB function block

stateflow

I have a Model block connected to a Merge block. The referenced model contains a Stateflow chart, Stateflow truth table, or Embedded MATLAB Function block, whose output is connected to the root Outport that in turn is connected to the Merge block. Why do I get an error message that says:
The signal from 'test/Model' output port 1 is required to be persistent, hence this signal cannot be connected to a Merge block.
 

Best Answer

This is a known limitation of Stateflow in all releases since R2007b. To work around the issue, you can insert a Signal Conversion block between the Stateflow chart, Stateflow truth table, or Embedded MATLAB Function block and the root Outport, and set its Output parameter to "Signal copy".