6

I have a 24x2 matrix in matlab. I need to represent this data in a table but also make sure that each of the rows are colored on various hues of a colors (like a heat map) based on the values of the second column.

Is there a matlab function that can render such table figures? Or is there any other language or tool that can support such a facility?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Dexters
  • 2,419
  • 6
  • 37
  • 57
  • 2
    The best way of doing this may depend on what you are planning on using the final table for. Will you just be looking at it in MATLAB, or will you be including it in a document? If it's for a document, will that be Microsoft Word, LaTeX, HTML, or something else? – Bill Cheatham May 22 '12 at 07:02
  • I am looking to use the table in LaTeX. Am still exploring a few other options as well. – Dexters May 24 '12 at 02:35
  • If you are looking to use it in LaTeX I would recommend writing a quick script to actually generate the LaTeX table code from your data, together with the row colouring. (At least, this would give the nicest looking results). – Bill Cheatham May 24 '12 at 08:16
  • 1
    Here is what is used finally. http://www.mathworks.com/matlabcentral/fileexchange/24253-customizable-heat-maps This served my purpose and gave quite a few options for customizing just enough for my work. – Dexters Oct 27 '12 at 18:58

3 Answers3

5

You can use uitable to display a matrix as a table. It has a BackgroundColor property, but that can only be set for the entire table.

You can however get around this by inserting custom HTML tables like described here.

Junuxx
  • 14,011
  • 5
  • 41
  • 71
3

Here's the uitable properties list:

http://www.mathworks.com/help/techdoc/ref/uitableproperties.html

Using handles, you can create one figure and make individual tables, each one column, each with their own BackgroundColor and Position properties.

Here's an example of multiple uitables on one figure:

Display multiple uitable objects in the same figure?

Community
  • 1
  • 1
Keegan Keplinger
  • 627
  • 5
  • 15
1

Here is what finally worked for me.

https://www.mathworks.com/matlabcentral/fileexchange/24253-customizable-heat-maps

The trick I used is I made the first column values as labels to each row (similar to giving labels on y axis) and the made each cell representing the value by a hue of a color.

For example: If we chose to use red. The cells will be colored dark red for a high value and white for a zero value and goes on for various intermediate values.

This served my purpose and gave quite a few options for customizing just enough for my work.

Dexters
  • 2,419
  • 6
  • 37
  • 57