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일

0 개 추천

댓글 수: 3

Lucky
Lucky 2020년 10월 6일
Thanks Walter, I have read this page but I still couldn't figure out how to do this.
I can't use the Data store memory and data read memory block as I am using these variables in a different function I have created. It also shows a way to go to model explorer and add a simulink signal . but I didn't understand that.
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개)

카테고리

도움말 센터File Exchange에서 Event Functions에 대해 자세히 알아보기

제품

릴리스

R2018b

질문:

2020년 10월 6일

댓글:

2020년 10월 8일

Community Treasure Hunt

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

Start Hunting!

Translated by