Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在MatlabGUI表格中更改特定单元格颜色_Matlab_User Interface_Background Color - Fatal编程技术网

在MatlabGUI表格中更改特定单元格颜色

在MatlabGUI表格中更改特定单元格颜色,matlab,user-interface,background-color,Matlab,User Interface,Background Color,我正在编写一个GUI,其中包含一个表。 该表名为:“价格表”,如下所示: name price 1 a 5 2 b -6 3 c 7 如何使“price”列的背景色根据其中的值进行更改?例如,如果单元格包含负数(如-6),我希望背景颜色为红色,如果为正数,则背景颜色为绿色 此时此刻,我正在使用: set(handles.Price_Table,'Data',[name price],'backgroundcolor',[1

我正在编写一个GUI,其中包含一个表。 该表名为:“价格表”,如下所示:

   name     price
1   a         5
2   b        -6
3   c         7
如何使“price”列的背景色根据其中的值进行更改?例如,如果单元格包含负数(如-6),我希望背景颜色为红色,如果为正数,则背景颜色为绿色

此时此刻,我正在使用:

set(handles.Price_Table,'Data',[name price],'backgroundcolor',[1 0 0])

但是它改变了整张桌子。

也许对你有帮助。嘿,谢谢你的回答。有没有不使用java的选项?就像选择特定的单元格(1,2)并为其背景着色一样?如果没有,你能解释一下我的代码的javaaddpath是什么吗?很抱歉这么晚才回答,你尝试过提出的解决方案了吗?它工作得很好,没有java.html就完成了我使用的工作:colergen=@(颜色,文本)['',文本,'';数据{indexx,indexy}=colergen('#00FF00',num2str(数据{indexx,indexy}));谢谢你的回复,这个链接很有用。也许对你有帮助。嘿,谢谢你的回答。有没有不使用java的选项?就像选择特定的单元格(1,2)并为其背景着色一样?如果没有,你能解释一下我的代码的javaaddpath是什么吗?很抱歉这么晚才回答,你尝试过提出的解决方案了吗?它工作得很好,没有java.html就完成了我使用的工作:colergen=@(颜色,文本)['',文本,'';数据{indexx,indexy}=colergen('#00FF00',num2str(数据{indexx,indexy}));谢谢你的回复,链接很有用。