comment out many SubSystems in my Model in Simulink using for loop.

조회 수: 1 (최근 30일)
Kamal
Kamal 2022년 5월 3일
댓글: Kamal 2022년 5월 3일
I have 10 subsystems in one system, and i want to comment out 3 of them using a Matlab code.
instead of
set_param ('System/subsystem1','commented','on')
set_param ('System/subsystem2','commented','on')
set_param ('System/subsystem3','commented','on')
I want to do somthing like this :
for i=1 : 3
set_param ('System/subsystem(i)','commented','on')
end
The Problem is i can't use a Variable in this expression 'System/subsystem(i)'

채택된 답변

Fangjun Jiang
Fangjun Jiang 2022년 5월 3일
num2str()
  댓글 수: 3
Fangjun Jiang
Fangjun Jiang 2022년 5월 3일
for i=1 : 3
Name=['System/subsystem', num2str(i)]
end
Name = 'System/subsystem1'
Name = 'System/subsystem2'
Name = 'System/subsystem3'
Kamal
Kamal 2022년 5월 3일
Thanks a lot Fangjun, it was verry helpfull

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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