How to programmatically rename all instances of a signal/variable in a Simulink model?

조회 수: 12 (최근 30일)
Hello, I would like to write a script that can find all instances of a signal in a Simulink model and rename it. For example, let's say I have a signal "bus1.Signal" that I would like to rename to "bus1.subBus.Signal". There are many, many subsystems in my model, and I would like to rename all instances of the signal from the Command Window or via a script. Thanks in advance!

채택된 답변

Fangjun Jiang
Fangjun Jiang 2022년 9월 8일
It is NOT a signal. Rather, it is a "Bus Element In" "Inport" block.
blks=find_system('ModelName','FindAll','On','BlockType','Inport','PortName','bus1','Element','Signal')
set_param(blks,'Element','subBus.Signal')

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Subsystems에 대해 자세히 알아보기

태그

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by