Display specific element of MATLAB table in bold?

조회 수: 20 (최근 30일)
Ashish Sheikh
Ashish Sheikh 2020년 1월 23일
답변: Walter Roberson 2020년 1월 27일
Hi ,
Is there a way in MATLAB to display specific element of MATLAB table in bold ?
For ex:
A=[1,2,3;4,5,6]
myTable = array2table(A);
% This is going to be my table output ... can i make 2 an 6 in bold ?
myTable =
2×3 table
A1 A2 A3
__ __ __
1 2 3
4 5 6

답변 (2개)

Gaurav Garg
Gaurav Garg 2020년 1월 27일
Hi,
You can create a cell array of paragraph and then convert the desired elements to bold. You can refer to the below code:
import mlreportgen.dom.*;
A=rand(3,3);
ca=cell(size(A,1),size(A,2))
for i = 1:size(A,1)
for j = 1:size(A,2)
ca{i,j}=Paragraph(num2str(A(i,j)));
end
end
ca{1,1}.Children(1).Bold = true; % Use this line to set a specified element as bold
% To view contents in a cell -
ca{1,1}.Children(1).Content
  댓글 수: 1
Walter Roberson
Walter Roberson 2020년 1월 27일
That looks to me to be specific to Report Generator ??
I think the user is asking about regular table() objects.

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


Walter Roberson
Walter Roberson 2020년 1월 27일
Not for table() objects, no.
For uitable() objects, then for traditional figures, there is a trick of using HTML1.1 wrappers around the text. Something like <HTML><STRONG>2</STRONG> . I do not recommend this approach, but it is possible.
For uifigures instead of traditional figures, I do not know.

카테고리

Help CenterFile Exchange에서 Develop uifigure-Based Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by