Placing a Matlab function block with a call to a Simulink function in a for each subsystem

3 ビュー (過去 30 日間)
Rishab Anand
Rishab Anand 2024 年 5 月 24 日
回答済み: Shivansh 2024 年 5 月 26 日
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 ?

回答 (1 件)

Shivansh
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!

カテゴリ

Help Center および File ExchangeSubsystems についてさらに検索

製品


リリース

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by