0

I am currently developing a set of GUIs in Matlab (w/ GUIDE) for automated data post-processing. Data is displayed in a set of axes, while a button allows the user to "shift" through various datasets (1 at a time). A table (located below these figures) illustrates characteristics of all the existing datasets.

I would like to be able to highlight the relevant set of data in my table that corresponds to the displayed figure (i.e. a row w/in the table). Is there any way to either change the background color of a row within the table, or place a transparent, colored rectangle over the row? (the "rectangle" command doesn't work, as it only applies to areas within axes objects).

Thanks for your help,

Colin Waldo

  • 1
    One way is to use HTML code...check this answer it might help you: http://stackoverflow.com/questions/17179462/changing-the-background-color-of-a-table-cell-in-matlab-using-html-content – Benoit_11 Oct 29 '14 at 20:03

1 Answers1

0

Do I understand that you want to be able to highlight a single row in a uitable?

You can do that by customising the BackgroundColor property:

f = figure;
data = rand(5);
colnames = {'X-Data', 'Y-Data', 'Z-Data'};
t = uitable(f, 'Data', data, 'ColumnName', colnames, 'Position', [20 20 260 200]);

% highlight row three
bgColor = ones(5,3);    % this needs to be the same size as your number rows.
bgColor(3,:) = [0 0 0]  % highlight row 3
t.BackgroundColor = bgColor
t.ForegroundColor = [1 1 1] % set the foreground color the same as main background
matlabgui
  • 5,642
  • 1
  • 12
  • 15