How to pass mask parameters in a child Matlab function ?
5 views (last 30 days)
Show older comments
Alexandre SAULNIER
on 9 Jun 2022
Commented: Alexandre SAULNIER
on 10 Jun 2022
Hello everyone,
In my model, I created a masked subsystem with many parameters (around 90 parameters). In this subsystem, I introduced a Matlab function and I need to use the parameters I defined earlier in the parent-subsystem mask to resolve equations.
The content of the parent masked-subsystem is represented in the screenshot below :

The yellow blocks correspond to blocks which use a parameter from the mask upper in the block hierarchy and these parameters are recognized. However, they're not in the Matlab function.
I looked on the help center but no topics correspond to the issue I'm encountering. I don't want to create a mask for the Matlab function with the same parameters or to add around 90 constant blocks grouped by a bus to send it to the Matlab function.
So, here is my question : why does Matlab function not recognize the mask parameters ?
I kindly thank you in advance for your answers,
Best regards
AS
0 Comments
Accepted Answer
Fangjun Jiang
on 9 Jun 2022
For those yellow blocks or any of the typical Simulink blocks, there is a block parameter dialog, where you can specify a variable for a parameter. This variable is usually defined in workspace, but you can mask it and provide its value through mask dialog. This is how mask works.
So you need to add a "parameter" to the MATLAB Function. Click "edit data" button at the Editor, add a data and specify it as "parameter".
More Answers (0)
See Also
Categories
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!