Dynamic Masking using Checkboxes

23 views (last 30 days)
Josh
Josh on 20 Jan 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!

Answers (1)

Guy Rouleau
Guy Rouleau on 20 Jan 2013
  2 Comments
Josh
Josh on 21 Jan 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 on 21 Jan 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?

Sign in to comment.

Products

Community Treasure Hunt

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

Start Hunting!