- 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?
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (1)
Sandeep Mishra
il 10 Ott 2024
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 Commenti
Vedere anche
Categorie
Scopri di più su Create Block Masks in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!