Create two different masks for a subsystem

1 次查看(过去 30 天)
Hello everyone,
I'm looking for a way to create two differents masks for a subsystem block in Simulink. I need it because I need to create a block, which is capable to show a mask when the simulation is stopped and another mask while the simulation is running. For the moment I wrote this code to put inside the OpenFcn
if (strcmp(get_param(gcs, 'SimulationStatus'),'paused') | strcmp(get_param(gcs, 'SimulationStatus'),'running') )
open_system(gcb, 'mask1')
else
open_system(gcb, 'mask')
end
but I cannot use because I don't know how to create two masks for a susbsystem
can you help me? at least is it possible to create two different mask?
thanks in advance
  1 个评论
grapevine
grapevine 2012-3-9
ps
I don't have a variant subsystem in my matlab
http://www.mathworks.nl/help/toolbox/simulink/ug/bsn6z6m.html#bsk8r3f-7

请先登录,再进行评论。

采纳的回答

Kaustubha Govind
Kaustubha Govind 2012-3-9
AFAIK, there's no way to create multiple masks for a block. The best you can do to change the appearance of your mask is to swap the properties of the mask itself. Also, the only thing you can change during a simulation are values of tunable parameters, so I don't think that Simulink will let you change things like MaskVariables like you want to, during simulation.
Perhaps you could explain more about what you're trying to do, so we can suggest an alternate solution if available.
  2 个评论
grapevine
grapevine 2012-3-12
Thanks for your answer, actually my prof asked me to create a system, where it's possible to force an ouput value during the simulation, and when the simulation is over it should be possible to access to a different set of parameters
I tried this solution by introducing a susbsystem inside the main model,
if (strcmp(get_param(gcs, 'SimulationStatus'),'paused') | strcmp(get_param(gcs, 'SimulationStatus'),'running') )
open_system(strcat(gcb,'/Forçage'), 'mask')
else
open_system(gcb, 'mask')
end
but we have some problem, when we use this block as linked block of a library
http://www.mathworks.com/matlabcentral/answers/31754-how-to-turn-off-a-warning-dialog-box
Now as you suggested me I'm looking for a solution using the mask properties.
I thought to use set_param and these parameters
- MaskEnables
- MaskVisibilities
in order to show certain parameters only during the simulation
but they accept as argument an array of cells, and I don't undestrand how to create it, do you know how I can do it?
thanks 4 the help
grapevine
grapevine 2012-3-12
I found it
set_param(gcb,'MaskVisibilities',cellstr(char('on','off'))

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Author Block Masks 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by