Declare global variable in simulink
7 次查看(过去 30 天)
显示 更早的评论
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/373146/image.jpeg)
0 个评论
采纳的回答
Walter Roberson
2020-10-6
Global variables work differently in Simulink. See
3 个评论
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.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Simulink Functions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!