Modifying a Simulink model mask from a Matlab app, built in App Designer.
Show older comments
In Simulink, I have built a subsystem block with a mask, which includes a 'popup' mask entry, allowing the user to set a parameter to 'on' or 'off'. I now want to write to this parameter from a Matlab app, using, for example, the simulink.compiler.modifyParameters command, not the set_param command, because I want to deploy the app.
In the documentation for simulink.compiler.modifyParameters, examples are given to modify an 'edit' parameter in a mask, e.g.:
if time==5.0
% Modify global variables used by top model gain block
newGlobalVars = [Simulink.Simulation.Variable('gNum',1.1),...
Simulink.Simulation.Variable('gDen',0.5)];
simulink.compiler.modifyParameters(model,newGlobalVars);
end
However, this won't work for a 'popup' mask entry. How can I use simulink.compiler.modifyParameters to achieve this? For example, would:
parameterPath = [modelName '/' subsystemName '/' parameterName]
newParam_popup = struct(parameterPath, 'off');
simulink.compiler.modifyParameters(model, newParam_popup);
work i.e. writing directly to the mask path, not requiring the parameter to be set as a global or model workspace variable?
Thanks for any help provided!
Accepted Answer
More Answers (0)
Categories
Find more on Simulink in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!