Declare global variable in simulink

14 ビュー (過去 30 日間)
Lucky
Lucky 2020 年 10 月 6 日
コメント済み: Lucky 2020 年 10 月 8 日
In Simulink,I need to use one of the inputs to a function block in another saved function. So I want to decalre this input as global in the simulink but once i do that I get the following error.
Global declaration not resolved to a Data Store Memory block registered via the Ports and Data Manager.
Here the variable R is given as input and I want to declare this as a global variable and use it in a function which I am using in this model.

採用された回答

Walter Roberson
Walter Roberson 2020 年 10 月 6 日
  3 件のコメント
Walter Roberson
Walter Roberson 2020 年 10 月 6 日
You do not need a Read Memory block. You need to create one Data Store Memory block for each global variable. The sequence is described at https://www.mathworks.com/help/simulink/ug/using-global-data-with-the-matlab-function-block.html#bsdud7d-1
You might need to do step 3 (Ports manager) for each different MATLAB Function Block you have that uses the global variable.
Lucky
Lucky 2020 年 10 月 8 日
This works .. thanks a lot Walter Roberson

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by