Simulink Mask newline or line feed in Static Text Control?
21 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (2)
Nicolas B.
el 12 de Ag. de 2019
Editada: Nicolas B.
el 12 de Ag. de 2019
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 comentarios
Jean-Guilhem Dalissier
el 19 de Jul. de 2022
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>
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1070215/image.png)
0 comentarios
Ver también
Categorías
Más información sobre Author Block Masks 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!