I have a MATLAB Function block wrapped in a masked subsystem. The subsystem's mask has a parameter p1
which I want to use inside the MATLAB function. How to do this manually is described in the documentation. However, I need to do this programmatically and so far I've failed to figure out how to do this.
Adding the parameter to the subsystem's mask programmatically is easy using Simulink.Mask.addParameter
, as is creating the MATLAB Function block and setting its code. The hard part is to programmatically switch the scope of the function argument p1
from "Input" to "Parameter" (Steps 2-4 in the documentation). I couldn't find where this information is stored (I checked both the "traditional" Simulink block parameters and the Stateflow object associated with the block).