Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You can do it by putting html code in the cell data, there is a guide on the MATLAB site with an example, but IMHO it's not very elegant way of doing it as it makes the content a string and hides the data. It makes any subsequent data handling very awkward as you have to start separating out the html code.</p> <p><a href="http://www.mathworks.com/support/solutions/en/data/1-D782JW/index.html?product=ML&amp;solution=1-D782JW" rel="nofollow">http://www.mathworks.com/support/solutions/en/data/1-D782JW/index.html?product=ML&amp;solution=1-D782JW</a></p> <p>So the content of the cell ends up like this</p> <pre><code>&lt;html&gt;&lt;font color="blue"&gt;'my text'&lt;/font&gt;&lt;/html&gt; </code></pre> <p>So a worked example to clarify the comments, as I realised that the example above colours the text and not the background as requested.</p> <pre><code>scores=cell(7,10); scores(3,4)={'&lt;html&gt;&lt;font bgcolor=#FF8800&gt;my text&lt;/font&gt;&lt;/html&gt;'} f=figure uit = uitable(f, 'Data', scores,'Units', 'normalized','Position', [0 0 1 1]); </code></pre> <p>This creates the cell array of scores with one cell html inserted. When you create the uitable you set the property 'Data' to this cell array. If you have already created your table via guide then you should have a handle to the table object, in which case you should be able to use set</p> <pre><code>set(uitableHandle,'Data',scores); </code></pre> <p>As I said it's a bit messy and doesn't work that well as it just colours the text background rather than the entire cell but I think that's the best you'll get with using the native MATLAB GUI widgets.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload