How do I get to boldface the numbers that I input?

조회 수: 14 (최근 30일)
Christella Bañaga
Christella Bañaga 2022년 6월 4일
댓글: Steven Lord 2022년 6월 7일
Here is an intruction and a sample output to what it is supposed to look like.
  댓글 수: 1
Steven Lord
Steven Lord 2022년 6월 7일
Are you certain that your assignment requires you to display the user's answers in boldface, or did the instructor simply write the answers in boldface in the text of the assignment for emphasis?

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

답변 (2개)

Sam Chak
Sam Chak 2022년 6월 4일
You can use the TeX markup option for the bold font.
\bf text

Hans Scharler
Hans Scharler 2022년 6월 7일
I know some fprintf tricks for text formatting, although it might not be elegant. You can use strong inside of fprintf.
outputNumber = randi(99);
fprintf('What is the meaning of life? <strong>%d</strong>', outputNumber)
What is the meaning of life? 21
Also, there is a File Exchange / Add-on called "cprintf" for customizing the output in the command window: https://www.mathworks.com/matlabcentral/fileexchange/24093-cprintf-display-formatted-colored-text-in-command-window

카테고리

Help CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by