我想设置在单元格背景颜色的细胞..MATLAB设置背景色uicontrol
类似:
所以我有RGB颜色和我想要着色的单元格的数量。
你可以认为单元格的位置是我写的。
我的颜色是由RGB给出:
color = [255 0 0];
我想将其添加到第10电池,所以我写了类似:
S.cell_data(10) = uicontrol('style','text',...
'units','pix',...
'Position',[20 70 80 40],...
'string',color);
但风格是不是“文本”和它不是一个字符串。
这就是我想现在:
S.cell_data(10) = uicontrol('style','text',...
'units','pix',...
'Position',[125 70 80 40],...
'string','fh');
parentColor = get(get(S.cell_data(10), 'parent'), 'color');
set(S.cell_data(num_of_cols+1),'foregroundcolor', [0 0 0], ...
'backgroundcolor', parentColor);
有人知道?
请详细说明,不清楚。 –
我添加了一个例子:] –