Global variables in 'Attribute Function' block (Simulink - Sim events)

5 ビュー (過去 30 日間)
Max
Max 2012 年 5 月 6 日
I want to use 'Attribute Function' block (Simulink, SimEvents) to set attribute value of entities, but I need a some global variables to store data. How I can do this?
I tried to use 'Data Store' block but I guess there is no ability to use this block for the 'Attribute Function' block.

採用された回答

Devdatt Lad
Devdatt Lad 2012 年 5 月 6 日
Currently, it's not possible to use global data, signal input/output or parameters with the Attribute Function block. The attribute function must be used with attribute input/output only. It's a limitation that we're working to remove.
In the meantime, you can do one of the following:
1. Set the global data as an attribute of the entity so that you can access it in the Attribute Function block.
2. Use the MATLAB Function block instead of the Attribute Function block. For this case, you will have to add an additional Get Attribute before the MATLAB Function to get the attributes that you want to use in your function. You also need an additional Set Attribute block to set the result of the function back as attributes of the passing entity. And finally you wil need a zero delay server block between the Get and Set Attribute blocks to hold each entity while the attribute value is computed.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDiscrete-Event Simulation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by