필터 지우기
필터 지우기

How to bold a phrase in a textbox?

조회 수: 24 (최근 30일)
Leon
Leon 2020년 10월 3일
답변: Shubham Khatri 2020년 10월 8일
Below is my code. How do I bold the phrase "Flag: "?
C = [C, newline, ['Flag: ', num2str(B(i)) ] ];
app.text1.Value = C;
Many thanks.

답변 (1개)

Shubham Khatri
Shubham Khatri 2020년 10월 8일
To my understanding, you are trying to write a string in a textbox in line 1. Then followed by another string “Flag:” and a number as a string in line 2. You want to bold the term “Flag:”. Please have a look at the code below to perform this operation
str = 'String in line 1'; %string for line 1
x=2; %number to be treated as string
y=['\bf Flag:','\rm' num2str(x)]; %contents of line 2 along with font styles
str=[str newline y] %Arranging the text in order which we want to see
t = annotation('textbox','string',str) %placing the text in textbox
Please refer to the following documentation links for more information Newline , Annotation[SK1] , Textbox properties.

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by