필터 지우기
필터 지우기

Update Inport/outport and signal names faster

조회 수: 9 (최근 30일)
Josh
Josh 2023년 1월 16일
답변: Luca Ferro 2023년 1월 17일
I am trying to update a lot of port and signal names. We usually use a prefix like "LvrA_" before all signal names to make code integration easier later. However if we ever need to change it to something like "Lvr1_" the fastest way I've found is to click in each box of the Model Data Editor for 100+ ports and signals. Is there a better way to do a find replace, export to a file that allows doing find replace and import or something else similar? Maybe I've been using poor keywords but I've been searching and can't seem to find anything.

답변 (1개)

Luca Ferro
Luca Ferro 2023년 1월 17일
The last time i had to do something similar i created a script along these lines:
legend: action-(function i would use)
  • load simulink file (load_system)
  • get all blocks in the model ( Simulink.findBlocks)
  • loop through all the said blocks (for)
  • filter them by the prefix LvrA (getfullname/get_param)
  • change the prefix into Lvr1_ (set_param)
  • save (save_system)
Try to experiment yourself and get back at me if you need help with any of these functions.

카테고리

Help CenterFile Exchange에서 Programmatic Model Editing에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by