按下键时如何在Matlab上获取uicomponent滑块的值?我在 GUI 代码中使用它:
% --- Executes just before teste is made visible.
function teste_OpeningFcn(hObject, eventdata, handles, varargin)
% Choose default command line output for teste
handles.output = hObject;
handles.slid=uicomponent('style','slider',0,9,5,'position',[10 30 200 50]);
set(handles.slid, 'KeyPressedCallback','handles.slid.value');
% Update handles structure
guidata(hObject, handles)
滑块工作正常,但是当我按下一个键时,这会返回错误"Undefined variable "handles" or class "handles.slid.value"。如何解决?