Blockname in 2 lines

13 visualizaciones (últimos 30 días)
Malu el 29 de Ag. de 2023
Editada: Malu el 30 de Ag. de 2023
When trying to highlight the blocks in simulink model using hilite_system, it is showing errors for those blocks that has a new line in the string. For example, Instead of RelationalOperator, if the blockname is
Opeartor, it is showing errors for such blocks. Not opening the model and highlight the block. How can it read the complete blockname . The error i am getting is" Error: Character vector is not terminated properly." it is reading only till xx/yy/Relational
not the name in the second line. How can i avoid the error without changing the blockname?

Respuesta aceptada

Yash el 30 de Ag. de 2023
The issue you're encountering with hilite_system in Simulink is related to the way it processes block names with newline characters. By default, hilite_system and some other Simulink functions may not handle block names with newlines as you'd like.
However this issue can be addressed without changing the block name, one of the approach has been demonstrated below.
Approach : Treat new line characters as spaces :
Method 1 : Suppose the name of your block is
block_name = 'Relational
While making the call to the hilite_system just replace the new line characters as spaces.
hilite_system('your_model_name/Relational Operator','fade')
This will highlight the block in your code.
Method 2 : Use Block Path
blockPath = getfullname('your_model_name/Relational Operator');
This will also work as intended
Either of these approaches should allow you to highlight blocks with newline characters in their names without changing the block name itself.
I hope this helps.
  1 comentario
Malu el 30 de Ag. de 2023
Editada: Malu el 30 de Ag. de 2023
Thanks for the suggestion. It works now.

Iniciar sesión para comentar.

Más respuestas (0)


Más información sobre Simulink Functions en Help Center y File Exchange.




Community Treasure Hunt

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

Start Hunting!

Translated by