【问题标题】:Generating Transparent Box outside of Axes in Matlab GUI在 Matlab GUI 中生成轴外的透明框
【发布时间】:2014-12-25 16:09:06
【问题描述】:
我目前正在 Matlab 中开发一组 GUI(带 GUIDE),用于自动数据后处理。数据显示在一组轴中,而一个按钮允许用户“切换”各种数据集(一次一个)。一张表(位于这些图下方)说明了所有现有数据集的特征。
我希望能够突出显示我的表格中与显示的数字相对应的相关数据集(即表格中的一行)。有没有办法改变表格中一行的背景颜色,或者在该行上放置一个透明的彩色矩形? (“矩形”命令不起作用,因为它只适用于坐标区对象内的区域)。
感谢您的帮助,
科林·沃尔多
【问题讨论】:
标签:
matlab
uitableview
user-interface
【解决方案1】:
我了解您希望能够突出显示 uitable 中的单行吗?
您可以通过自定义 BackgroundColor 属性来做到这一点:
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