我正在matlab中实现uicontrol,如下所示:
for m = 1: 10
uicontrol(Fig_handle,'Style', 'pushbutton',...
'String', sprintf('%s', ImgNames{m,2}),...
'Tag', sprintf('%s', ImgNames{m,2}),...
'Value', 0, 'Min',0, 'Max',1,...
'Units','normalized','Position',[.01+(m-1)/15 .05 .05 .02],...
'Callback', {@biomarker_Callback});
end
回调函数是:
function biomarker_Callback(hObject, ~, ~)
handles = guidata(hObject);
for m = 1:size(handles.ImgNames)
checkboxStatus = handles.Fig.(handles.ImgNames{m,2}).Value;
if checkboxStatus ==1
imh = imhandles(handles.Fig.screen);
Image = ind2rgb(handles.Image_adjusted.(handles.ImgNames{m,1}), handles.ImgNames{m,6});
set(imh,'CData',Image);
end
end
end
执行时,我收到此错误:
Undefined function 'biomarker_Callback' for input arguments of type 'double'.
Error while evaluating uicontrol Callback
在打印handles.Fig.(handles.ImgNames{m,2})
的值时,我得到一个整数,虽然我期望列,但是是Value的值。
同样运行的MATLAB R2015b也可以毫无失败地执行。
我不明白为什么会这样。有人可以帮我吗?