How do I change the color of individual cells in uitable in MATLAB?

31 ビュー (過去 30 日間)
MathWorks Support Team
MathWorks Support Team 2011 年 11 月 15 日
回答済み: MathWorks Support Team 2022 年 5 月 17 日
I would like to change the color of individual cells in a uitable.

採用された回答

MathWorks Support Team
MathWorks Support Team 2022 年 5 月 17 日
In R2019b and later version, for tables(uitable) created on uifigure or in container objects parented to uifigure (such as uipanel, uitab), you can use the uistyle / addStyle functions to specify the text color, background color, and other formatting options for certain cell in the table.
uit = uitable(uifigure, 'Data', randn(3));
[row,col] = find(uit.Data < 0); % get the index for negative values
s1 = uistyle;
s1.FontColor = 'red'; % set the style format
addStyle(uit,s1,'cell',[row,col]); % add style for the table
For details, please refer the documentation pages.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by