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

1 次查看(过去 30 天)
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'

采纳的回答

MathWorks Support Team
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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Simulink Functions 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by