uitable オブジェクトにおいて、セルごとに文字列の色を変更することはできますか?
13 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
MathWorks Support Team
le 3 Août 2016
Modifié(e) : MathWorks Support Team
le 17 Mai 2022
uitable オブジェクトの各セルごとにテキストの色を指定する方法を教えてください。
Réponse acceptée
MathWorks Support Team
le 17 Mai 2022
Modifié(e) : MathWorks Support Team
le 17 Mai 2022
R2019b 以降のリリースから uifigure 上に作成されたテーブル(uitable) もしくは uifigure を親とするコンテナーオブジェクト(uipanel や uitabなど)内に作成されたテーブルに対して、uistyle / addStyle 関数を用いて、任意のセルのテキストの色や背景色など、書式を指定することが可能です。
例:
uit = uitable(uifigure, 'Data', randn(3));
[row,col] = find(uit.Data < 0); % 負の値のインデックスを取得
s1 = uistyle;
s1.FontColor = 'red'; % テキストの色を赤色に設定
addStyle(uit,s1,'cell',[row,col]); % スタイルをテーブルに適用
詳細については、各関数のドキュメントをご覧ください。
・uistyle
・addStyle
R2019a 以前のリリースをご利用の場合は、各セルごとに、文字列の色を指定する機能はありません。ForegroundColor プロパティの指定により、一括設定することのみサポートされています。
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur App Designer を使用したアプリ開発 dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!