Disp(...) - How to do only ONE word in bold/underlined letters
76 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Marcel Langner
el 28 de Nov. de 2018
Comentada: Walter Roberson
el 28 de Mayo de 2021
Hi,
I want to Display a text which shall look for Example like this:
Hello World!
How to do that? I know it is possible to put a whole text in bold, but is it possible also to put just one word of the sentence in bold?
Thanks
3 comentarios
madhan ravi
el 29 de Nov. de 2018
I want to display it in the command window
Not here :-)
madhan ravi
el 29 de Nov. de 2018
Respuesta aceptada
Walter Roberson
el 29 de Nov. de 2018
7 comentarios
Walter Roberson
el 29 de Nov. de 2018
Bold cannot be done without magic.
Glancing at the current version of the code I am not sure bold is even supported at the moment.
What can be done without magic is underlining, such as
fprintf('Will you say <a href="">hello</a>\n')
which will output the hello underlined.
Also without magic you can emit red, with slightly more work:
fprintf('Will you say '); fprintf(2, 'hello\n')
The extra work here is that you need to fprintf() to unit 2 only for the text that is to be red.
Más respuestas (1)
Peng
el 8 de Ag. de 2019
why don't you use <strong> </strong> pair?
disp('Hello, <strong>World</strong>!');
3 comentarios
Herbert Middleton
el 28 de Mayo de 2021
Is there a way this could work for a number? (with "num2str")?
Walter Roberson
el 28 de Mayo de 2021
fprintf('Hello, <strong>World #%d</strong>!', randi(99))
Ver también
Categorías
Más información sobre Adding custom doc 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!