Create two different masks for a subsystem

1 Ansicht (letzte 30 Tage)
grapevine
grapevine am 9 Mär. 2012
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 Kommentar
grapevine
grapevine am 9 Mär. 2012
ps
I don't have a variant subsystem in my matlab
http://www.mathworks.nl/help/toolbox/simulink/ug/bsn6z6m.html#bsk8r3f-7

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Kaustubha Govind
Kaustubha Govind am 9 Mär. 2012
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 Kommentare
grapevine
grapevine am 12 Mär. 2012
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 am 12 Mär. 2012
I found it
set_param(gcb,'MaskVisibilities',cellstr(char('on','off'))

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Programmatic Model Editing finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by