【发布时间】:2013-06-15 07:01:04
【问题描述】:
我们知道uitable支持html内容
对于类似于我想要的示例,请参见 here
解决problem我在matlab中一个按钮的回调中使用这段代码之前问过的问题:
color = uisetcolor;
numberOfClasses = str2num(get(handles.edtNumClass,'String'));
if handles.index == 0
handles.tableData = cell(numberOfClasses,2);
guidata(hObject,handles);
end
handles.index = handles.index+1;
handles.tableData(handles.index,1)=cellstr(get(handles.edtNameClass,'String'));
handles.tableData(handles.index,2)=cellstr('<html><span style="background-color: rgb(color(1,1),color(1,2),color(1,3));"></span></html>');
set(handles.uitable2,'data',handles.tableData);
我的问题是这条线不起作用:
handles.tableData(handles.index,2)=cellstr('<html><span style="background-color: rgb(color(1,1),color(1,2),color(1,3));"></span></html>');
我的意思是当我在 matlab 中打开工作区时,我看到handles.tableData(handles.indexes,2) 被设置为字符串。
但背景颜色不会改变
甚至这个 html 代码也没有显示为简单的字符串。
单元格没有变化!!!
而且matlab没有给出错误信息!!!
请注意,我什至使用了此代码,但没有任何变化。
handles.tableData(handles.index,2)=cellstr('<html><span style="background-color: #FF0000;"></span></html>');
【问题讨论】:
标签: matlab user-interface cell background-color matlab-uitable