필터 지우기
필터 지우기

Blockname in 2 lines

조회 수: 14 (최근 30일)
Malu
Malu 2023년 8월 29일
편집: Malu 2023년 8월 30일
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?

채택된 답변

Yash
Yash 2023년 8월 30일
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.
  댓글 수: 1
Malu
Malu 2023년 8월 30일
편집: Malu 2023년 8월 30일
Hi,
Thanks for the suggestion. It works now.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Simulink Functions에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by