How to bold, italics sentence using fprintf in matlab?

조회 수: 147 (최근 30일)
komal Bhandari
komal Bhandari 2011년 12월 1일
댓글: Victoria Serrano 2024년 1월 30일
How to bold , italics sentence using fprintf in matlab

채택된 답변

Walter Roberson
Walter Roberson 2011년 12월 1일
There is no mechanism for that, just as there is no mechanism for color or underlining or blinking.
fprintf() is for transferring characters, and characters do not have inherent attributes or font properties.
Having said that: some output destinations interpret the characters they receive, and do so in such a way that character or font information can be attached.
The above are for output to the command window. If you happen to be outputting to a terminal emulator (e.g., if you are running matlab -nodesktop) then you may be able to take advantage of the ANSI sequences for text attributes: http://en.wikipedia.org/wiki/ANSI_escape_code#graphics

추가 답변 (1개)

Ryan Friedman
Ryan Friedman 2019년 5월 1일
You can print bold only (not italics) using fprinf as shown below.
fprintf('Hello <strong> bold </strong> world.\n')
>> Hello bold world.
  댓글 수: 8
Steven
Steven 2023년 11월 24일
Works nicely in the MATLAB console window (R2023b)
Unfortunatly when using publish() to create a pdf or html document the same example apears as 'Hello <strong> bold </strong> world.' in the document.
Victoria Serrano
Victoria Serrano 2024년 1월 30일
I'm having the same issue when using publish() to create the PDF. Has anyone found the solution?

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

카테고리

Help CenterFile Exchange에서 Debugging and Analysis에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by