How to delete labels of bus selector in a fast and easy way?

21 次查看(过去 30 天)
as showen in this picture, i need to delete all the labels one by one, and this caused a lot of trouble, so is there a quicker way to delete them or how to set to make them invisable?

回答(1 个)

Abhaya
Abhaya 2024-9-3,8:21
Hi Zuyuan,
I encountered the following issues while trying to remove labels from the output signals of a Bus Selector’ block in Simulink:
  • The task was repetitive, as each signal label needed to be deleted individually.
  • Labels would reappear upon updating the diagram.
  • Signal names in a Simulink ‘Bus Selector’ block are read-only, preventing direct renaming through programs.
To make the labels of the output signals of a Simulink ‘Bus Selector’ block invisible, I set the font size of the respective lines to 0. Following is the workaround that worked for me.
  1. Select all output signals of the Bus Selector by dragging over the lines.
  2. Execute the following MATLAB code:
currSystem = gcs; %get the current Simulink model
%find all the selected linesin the Simulink model
selectedLines = find_system(currSystem, 'FindAll', 'on', 'Type', 'Line', 'Selected', 'on');
%select each line and make their label invisible
for i = 1:length(selectedLines)
set_param(selectedLines(i), 'FontSize', 0);
end
This approach effectively hides the labels by setting their font size to zero.
Please refer the following link to explore the Simulink set_param’ function, https://www.mathworks.com/help/releases/R2020a/simulink/slref/set_param.html

类别

Help CenterFile Exchange 中查找有关 Simulink 的更多信息

标签

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by