MATLAB Answers

How can I comment out Simulink subsystem from Matlab script?

조회 수: 175(최근 30일)
Hi,
I just found out that there is a great option in Simulink which allows to comment out blocks and subsystems and exclude them form simulaton (right-click on block -> Comment out). I'd like to know, how can I do that using Matlab sctipt (or is it even possible?).
Thanks, Krzysztof

  댓글 수: 0

로그인 to comment.

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 20 Sep 2013
Suppose your model name is untitled , and you want to comment out the block named Unit Delay
set_param('untitled/Unit Delay','commented','on')
% to uncomment
set_param('untitled/Unit Delay','commented','off')

  댓글 수: 4

표시 이전 댓글 수: 1
santhosh
santhosh 18 Sep 2014
Can this command be applied to a subsystem? I tried it for a subsystem in my model and it didn't work. Any help?
Azzi Abdelmalek
Azzi Abdelmalek 18 Sep 2014
This should work for any block.
Krzysztof Szczupak
Krzysztof Szczupak 18 Sep 2014
Yes, this is working also for subsystems. Maybe you're providing wrong path for the subsystem? In the model click on the subsystem you want to comment, then in command window type this command:
set_param(gcb,'commented','on')
( gcb returns path to currently highlighted object on the model). This should comment subsystem you've clicked on.

로그인 to comment.

추가 답변(1개)

Hajir Pourbabak
Hajir Pourbabak 23 Mar 2016
Thanks A lot!

  댓글 수: 0

로그인 to comment.

이 질문에 답변하려면 로그인을(를) 수행하십시오.


Translated by