How can I highlight or change the color of certain values in a table

34 ビュー (過去 30 日間)
CarlijnB6
CarlijnB6 2016 年 12 月 29 日
コメント済み: Jeffery Devereux 2016 年 12 月 30 日
I am creating about 50 (46x9)tables with the command array2table and I would really like to highlight/change the color of values that are above a certain threshold, otherwise I have to do it manually. I know how to find the indices of these values (with the command find), however I cannot find a way to let these values stand out out of the rest of the data. How can I do this or do I have to use something else than array2table like uitable? And if uitable is the solution how would I do it?

採用された回答

Geoff Hayes
Geoff Hayes 2016 年 12 月 29 日
Presumably you are displaying your data in a GUI and so would need to use a uitable. See http://www.mathworks.com/matlabcentral/answers/25038-how-to-change-each-cell-color-in-a-uitable for an example on how to colour the cells.

その他の回答 (1 件)

Jeffery Devereux
Jeffery Devereux 2016 年 12 月 30 日
use html format for your cell data.. the set the background color accordingly:
TableCell = strcat('<html><b><font face = "Lucida Handwriting" font size = "3" color = "red" ><right><table border=0 width=400 bgcolor=#FFFFFF>',num2str(Numeric Value),'</center></html>');
  1 件のコメント
Jeffery Devereux
Jeffery Devereux 2016 年 12 月 30 日
TableCell = strcat('<html><b><font face = "Lucida Handwriting" font size = "3" color = "white" ><center><table border=0 width=400 bgcolor=#FFFFFF>',num2str(Numeric Value),'</center></html>');

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by