Simulink Mask newline or line feed in Static Text Control?
14 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
回答(2 个)
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.
0 个评论
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 > U2 </li> </ol>
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Author Block Masks 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!