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

1 view (last 30 days)
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)'

Accepted Answer

Fangjun Jiang
Fangjun Jiang on 3 May 2022
num2str()
  3 Comments
Fangjun Jiang
Fangjun Jiang on 3 May 2022
for i=1 : 3
Name=['System/subsystem', num2str(i)]
end
Name = 'System/subsystem1'
Name = 'System/subsystem2'
Name = 'System/subsystem3'

Sign in to comment.

More Answers (0)

Categories

Find more on Programmatic Model Editing in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!