How to change arrow labels of simulink blocks

22 ビュー (過去 30 日間)
Vibhu Mehta
Vibhu Mehta 2021 年 12 月 21 日
回答済み: Salman Ahmed 2021 年 12 月 31 日
% Firstly we have to read old signal labels or arrow labels of block diagrams in simulink through matlab code
%Then write new labels which replaces old one through matlab code

回答 (1 件)

Salman Ahmed
Salman Ahmed 2021 年 12 月 31 日
Hi Vibhu,
You can programmatically rename the Simulink signal line names by first doing a global search for that signal name in the model using "find_system" and then renaming the signal using "set_param".
1) To global search the names of lines in Simulink model:
To rename any line which is already labelled in the model, first you need to get the handle to that signal using "find_system" function with 'FindAll'-'on' and 'Name'-<Current signal name> as Name-Value arguments. See the example in the code snippet below.
open_system('vdp')
% get handle to the signal with label 'x1' using "find_system"
X1LineHandle = find_system('vdp','FindAll','on','Name','x1');
2) Renaming the signal lines:
Using "set_param" with 'Name'-<New line name> as Name-Value arguments as shown in the code snippet below, the signal lines can be renamed.
% Rename the signal label 'x1' to 's1' using "set_param"
for i = 1:length(X1LineHandle)
set_param(X1LineHandle(i),'Name','s1');
end

カテゴリ

Help Center および File ExchangeProgrammatic Model Editing についてさらに検索

製品


リリース

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by