Dynamic Masking using Checkboxes
6 次查看(过去 30 天)
显示 更早的评论
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!
0 个评论
回答(1 个)
Guy Rouleau
2013-1-20
In R2012b we added new examples showing how this can be done:
This post might also be useful:
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Programmatic Model Editing 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!