function gaodu(~,~)
c=color;
r=c(1,1);
g=c(1,2);
b=c(1,3);
if b>0
e={r^2.2+1.5*(g^2.2)+0.6*(b^2.2)/(3.7651)}^(0.454545);
h={[5.4698+sqr(5.4698^2-4*0.0364*(343.41-e))]/(2*0.0364)};
set( findobj('tag',[num2str(color_number-1),'H']),'string',['[',num2str(h),']'])
else b==0
e={r^2.2+1.5*(g^2.2)+0.6*(b^2.2)/(3.7651)}^(0.454545);
h={[5.4698+sqr(5.4698^2-4*0.0364*(343.41-e))]/(2*0.0364)};
set( findobj('tag',[num2str(color_number-1),'H']),'string',['[',num2str(h),']'])
end
end
color是一个矩阵[252,36,36]类似这种
但是一直出现错误说未定义与 'cell' 类型的输入参数相对应的运算符 '^'。
这个我要怎么解决啊?麻烦各位大佬帮我解答一下!
你的代码里变量color用的是元胞cell类型存储,不支持^计算,你代码第一句改成:
c=cell2mat(color)
就行了