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

9 visualizaciones (últimos 30 días)
zuyuan
zuyuan el 26 de Oct. de 2022
Respondida: Abhaya el 3 de Sept. de 2024
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?

Respuestas (1)

Abhaya
Abhaya el 3 de Sept. de 2024
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

Categorías

Más información sobre Programmatic Model Editing en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by