我尝试让uipanel更改边框颜色,同时在输入和面板按钮以外的其他位置按下并释放鼠标按钮。
function [oldpropvalues,varargout]=DisableFigure(handlearray,prop,propvalue,varargin);
oldpropvalues=get(handlearray,prop);
%this IF is used to highlight the "modal" panel when anywhere outside it is pressed
if length(varargin)==2
%these two are the old windowbutton functions which will be put back when the window is put back to normal.
varargout{1}=get(varargin{1},'windowbuttondownfcn');
varargout{2}=get(varargin{1},'windowbuttonupfcn');
set(varargin{1},'windowbuttondownfcn',['set(varargin{2},''bordertype'',''line'',''borderwidth'',2,''highlightcolor'',[0 0 0])']);
set(varargin{1},'windowbuttonupfcn',['set(varargin{2},''bordertype'',''beveledout'',''borderwidth'',1,''highlightcolor'',[1 1 1])']);
end
set(handlearray,prop,propvalue);
错误显示 未定义的变量" varargin"或者班级" varargin"。
评估图WindowButtonDownFcn
时出错未定义的变量" varargin"或者班级" varargin"。
评估图WindowButtonUpFcn
时出错答案 0 :(得分:1)
您的问题是您将window callbacks定义为字符向量,这些向量在变量return $query->result_array();
不存在的基础工作区中进行评估。您可以将其定义为anonymous functions:
varargin
答案 1 :(得分:0)
您没有显示您是如何产生错误的,但是从错误消息中,我猜您使用少于4个输入参数调用了该函数。然后varargin
不存在,因此matlab会给出错误。
为避免错误,您需要在使用nargin
之前检查varargin
,例如,将<{1}}语句行替换为
if