0
Matlab/Simulink 2016b에서 서브 시스템의 블록을 built-in/Inport
또는 built-in/Constant
으로 변경하고 싶습니다.Simulink Mask Editor : 블록 교체
disp(PortStat)
switch PortStat
case 'off'
if strcmp(get_param([gcb '/eng'],'BlockType'),'Inport')
disp('replace inport to constant')
replace([gcb '/eng'],'built-in/Inport','built-in/Constant')
get_param([gcb '/eng'],'BlockType')
replace_block([gcb '/eng'],'built-in/Inport','built-in/Constant')
get_param([gcb '/eng'],'BlockType')
end
case 'on'
if strcmp(get_param([gcb '/eng'],'BlockType'),'Inport')
disp('inport already exist')
end
if strcmp(get_param([gcb '/eng'],'BlockType'),'Constant')
disp('replace constant to inport')
replace([gcb '/eng'],'built-in/Inport');
end
end
체크 박스를 전환하면 다음과 같은 결과로 이어진다
on
inport already exist
off
replace inport to constant
ans =
myModel/Subsys/eng
ans =
Inport
ans =
Inport
BlockType는 변화하지 않는다. 하지만 왜?
상세 내용 :
- Syubsystem 라이브러리 객체 아니다.
- 나는
set_param(gcb, 'MaskSelfModifiable', 'on');
실행하고 회색 필드는 라이브러리 블록이 체크 아웃되어 마스크 편집기의 초기화 창에서 내용을 수정할 수 있도록 허용 .