Dynamic Masking using Checkboxes

6 visualizaciones (últimos 30 días)
Josh
Josh el 20 de En. de 2013
Hello,
I'm having some trouble getting a dynamic mask setup that uses checkboxes. I'm trying to create a block where checkboxes control which output ports are visible and not. I'd like it so that when a checkbox is unchecked, it's corresponding block output port is no longer visible. Here is the code I've found and modified for the dialog callback:
thisVariable = 'quatStatus';
affectedVars = 'Port';
thisBlock = gcb();
thisVarState = get_param(thisBlock, thisVariable);
maskNames = get_param(thisBlock, 'MaskNames');
maskEnables = get_param(thisBlock, 'MaskEnables');
for varName = affectedVars
varIndex = find(ismember(maskNames, varName));
maskEnables{varIndex} = thisVarState;
end
set_param(thisBlock, 'MaskEnables', maskEnables);
where quatStatus is the variable I've assigned to the checkbox parameter. I think the issue is that I'm not controlling the port I'm interested in.
Thanks!

Respuestas (1)

Guy Rouleau
Guy Rouleau el 20 de En. de 2013
  2 comentarios
Josh
Josh el 21 de En. de 2013
Thanks for the info. I gave it a look through and found this bit that looks helpful:
enab = get_param(gcb,'quatStatus');
if strcmp(enab,'on')
set_param(gcb, ???, 'on');
else
set_param(gcb, ???, 'off');
end
However, I'm still having trouble setting the port mask visibilities. I'm not sure how to select the port of interest and control its visibility. Is this done in the with the set_param function?
Thanks!
Josh
Josh el 21 de En. de 2013
Is this process done with something simple like a set_param call that hides that portion of the mask? Or do I need to actually have it create/delete ports?

Iniciar sesión para comentar.

Categorías

Más información sobre Programmatic Model Editing en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by