Dynamic Masking using Checkboxes

6 次查看(过去 30 天)
Josh
Josh 2013-1-20
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!

回答(1 个)

Guy Rouleau
Guy Rouleau 2013-1-20
  2 个评论
Josh
Josh 2013-1-21
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 2013-1-21
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?

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Programmatic Model Editing 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by