필터 지우기
필터 지우기

Simulink Mask newline or line feed in Static Text Control?

조회 수: 19 (최근 30일)
Jerry Girard
Jerry Girard 2016년 11월 1일
답변: Jean-Guilhem Dalissier 2022년 7월 19일
Is there a way to force a line feed or newline within text on a static text control in a Simulink mask?
I tried the typical \n \\n \n\r \newline chr(10) uint8(10) chr(13) uint8(13), etc. Nothing worked. The text was always printed literally.
I tried for days to look for help and documentation, but came up with nothing.
Is there an escape sequence that will work?

답변 (2개)

Nicolas B.
Nicolas B. 2019년 8월 12일
편집: Nicolas B. 2019년 8월 12일
Hey Jerry,
I just experienced the same issue as you. I found no solution to add a space in a Text Display box through the Mask Editor.
However, I have found a workaround! Let's imagine you have a textbox with the name myTextBox in the mask and you want to write :
line 1
line 2
Then, use select the block in Simulink (to be able to use gcb) and then, in the MATLAB console:
% get the handle of the mask
maskObj = Simulink.Mask.get(gcb);
% get the handle of the Text box
tbObj = maskObj.getDialogControl('myTextBox');
% set the Prompt value
tbObj.Prompt = ['line 1', ...
10, ... % 10 must be a numerical value to be ASCII(10)
'line 2'];
% now, check your mask.It should have worked
Hope it helps.

Jean-Guilhem Dalissier
Jean-Guilhem Dalissier 2022년 7월 19일
A solution is to use the HTML break tag:
line 1<br>line 2
More generally the Prompt field of a control seems to accept HTML so more sophisticated formatting may be acheived, for example:
Some text formatting in a list:<ol><li>Normal <b>bold</b> <i>italic</i> <span style="font-family:'Courier New';color:red;font-size:10px">Small_Red_CourierNew</span></li> <li>P = R<sub>1</sub>.I<sup>2</sup></li> <li>U1 &#62; U2 </li> </ol>

카테고리

Help CenterFile Exchange에서 Author Block Masks에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by