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

조회 수: 2 (최근 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 CenterFile Exchange에서 Discrete-Event Simulation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by