Blockname in 2 lines
4 views (last 30 days)
Show older comments
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
Relational
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?
0 Comments
Accepted Answer
Yash
on 30 Aug 2023
Hi @Malu
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
Operator'
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');
hilite_system(blockPath,'error');
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.
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!