Why does Embedded MATLAB Function block not inherit the input port size in Simulink 6.0 (R14) and later?

4 views (last 30 days)
I use the Embedded MATLAB Function block in my model. I also have a direct feedback from the outputs of this block to its inputs. When I try to set the input port size to be inherited, I get the following error:
Embedded MATLAB Interface Error: 'fuel_migration/getWeight - While Iterator Subsystem/call_getWeight - EMF/ SFunction ' cannot use 'set default dimension function'

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
This is intended behavior in Simulilnk 6.0 (R14) and later, when the Embedded MATLAB Function block has a direct feedback connection.
In this case, the size of the input to the Embedded MATLAB Function block depends on the size of the output from the same Embedded MATLAB Function block. Therefore, the size must be specified somewhere to break the loop. To handle this case, Simulink defaults the signal dimension to a scalar. You can verify this in the Model Explorer in the "compiled size" field for the input signal.
This behavior is expected because graphical loops without size/type specifications can potentially cause errors in the propagation algorithm and should be avoided.

More Answers (0)

Categories

Find more on Simulink Functions in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!