Placing a Matlab function block with a call to a Simulink function in a for each subsystem
3 次查看(过去 30 天)
显示 更早的评论
I have a Matlab function block that calls a Simulink function. I am trying to place this block into a for each subsystem and i get the following error.
The MATLAB Function cannot be placed inside a subsystem containing a "For Each" block. This might be because of one or more of the following reasons: 1. The MATLAB Function has a data with scope "Data Store Memory". 2. The MATLAB Function calls Simulink functions.
Is there a workaround to this problem ?
0 个评论
回答(1 个)
Shivansh
2024-5-26
Hi Rishab!
I understand that you are facing an error while putting a MATLAB function block containing data with scope "Data Store memory" inside a for each subsystem.
A possible workaround can be to remove the global variable from the MATLAB Function block and pass it as an input to the MATLAB Function block. You can use a Data Store Read outside the For Each Subsystem, use it as an input to the Subsystem, and then pass it to the MATLAB Function block as an input argument.
You can refer to the following documentation to know more about the limitations of For Each Subsystem: https://www.mathworks.com/help/simulink/ug/repeat-an-algorithm-using-a-for-each-subsystem.html#mw_76ab6d1d-3ef6-4c2e-9438-e226c070ddc0.
I hope it helps!
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Subsystems 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!