Formating individual cells in uitable or equivalent

5 views (last 30 days)
I am using uitable to display a table of values in a figure. I need to be able to color each cell in the table, based on some threshold. For example, values that meet or exceed this threhold value can be red. Values below the threshold can be green. It does not appear from the documentation that one can format individual cells this way using uitable.
Excel can do this, but I'd rather not be jumping from one tool to another. FWIW, I do not need the interactive features of uitable, but it was the only means I found to display a table in a figure.
  1 Comment
Jing
Jing on 28 Mar 2013
Edited: Jing on 28 Mar 2013
I don't think there's easy way to do that. It may be better if you use actxserver to create Excel instance in MATLAB, or the other way around by spreadsheet link EX.

Sign in to comment.

Accepted Answer

Jan
Jan on 28 Mar 2013
Edited: Jan on 28 Mar 2013
Another method is the Java level, e.g. http://undocumentedmatlab.com/blog/uitable-cell-colors/
A very good idea is to ask your favorite internet search engine for e.g. "Matlab uitable color" before asking the forum. You get a lot of helpful links. It should be mentioned, that Google needs 0.23 seconds to find more than 10'000 links. Although I really like and appreciate the competence of this forum, we cannot and should not compete with e.g. Google in cases of such standard problems. Ok?
The standard procedure for such questions is:
  1. Search in Matlab's documentation
  2. Search in the internet
  3. Search in the FileExchange and the Answers forum
  4. If not successful yet, ask the forum.
  1 Comment
Edward
Edward on 28 Mar 2013
Edited: Edward on 28 Mar 2013
Jan, Thanks for the link. As for the advice:
  1. I always check the documentation first. Usually I find my answer there, but sometimes it's not very clear.
  2. I had assumed searching the Matlab Central would be better than searching the entire internet. Perhaps my assumption is wrong.
  3. I always search MatLab Central after step 1. I never ask a question without doing this. I often stop at this step because I find what I'm looking for. But in this case, I didn't. I came across multiple instances of "You can't do that in uitable," which supported what I thought I learned in step 1...
  4. ...which brings me to the forum and the way I phrased by question, by saying I'm not married to uitable, if there is an alternative.
Again, thanks for your help. The links provide the solution I was looking for.

Sign in to comment.

More Answers (0)

Categories

Find more on Environment and Settings in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!