How do I get to boldface the numbers that I input?
5 次查看(过去 30 天)
显示 更早的评论
Here is an intruction and a sample output to what it is supposed to look like.![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1021445/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1021445/image.png)
1 个评论
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 个)
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)
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
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Environment and Settings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!