- In the MATLAB R2017b “MATLAB Function” block, navigate to the Editor tab and click on “Edit Data” in the Simulink section.
- In the Symbols pane, click the “Add Data” button.
- Define a new variable with the same name as the mask parameter (for example, “V_ca”).
- Set the “Scope” property of variable to “Parameter”
why can't Simulink get the variable initialized in mask?
조회 수: 4 (최근 30일)
이전 댓글 표시
As it has been shown in picture, I have initialized the variable in mask, but still can't compile.
I have tried to use the model properties - callbacks to initialize the variables, but failed too.
댓글 수: 0
답변 (1개)
Sandeep Mishra
2024년 10월 10일
Hi,
I encountered a similar issue while calling the mask variable inside the “MATLAB function” block after declaring it as a parameter in the subsystem’s mask.
To resolve this error, you can create a variable within the “MATLAB Function” block and set its scope to “Parameter”.
Refer to the following steps to create and access the variable:
After implementing these steps, you will see an additional parameter in the “MATLAB function,” which will be linked to the mask parameter.
Refer to the following MathWorks Documentation to learn more about “Use Data in Multiple MATLAB Function Blocks by Defining Parameter Variables”: https://www.mathworks.com/help/simulink/ug/parameter-arguments-in-matlab-function-block-functions.html
I hope this helps you.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Create Block Masks에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!