Dynamic Masking using Checkboxes

조회 수: 14 (최근 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