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

조회 수: 2 (최근 30일)
zuyuan
zuyuan 2022년 10월 26일
답변: Abhaya 2024년 9월 3일
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일
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