Problem with my Callback function or handles values
2 次查看(过去 30 天)
显示 更早的评论
Hi everybody, I have a problem with my function and I do not understand why.
Here is some part of my code:
handles.STANumber = 1;
handles.PanelPosition = [60 670 1098 80];
handles.AddSTA = uicontrol( 'Parent',handles.MainFigure,...
'style','pushbutton',...
'String','Add STA',...
'Tag','AddSTA',...
'Callback', {@AddSTA,handles});
handles.STANumber = handles.STANumber + 1;
....
function [handles] = AddSTA(hObject,eventdata,handles)
handles.AddSTA = hObject; % I DO NOT KNOW WHY THIS IS NEEDED. without this
% handles.AddSTA is not recognized - but all the
% other handles are recognized
handles.STANumber = handles.STANumber + 1;
My main problems are:
1. When I enter the AddSTA function the handles structure does not have AddSTA field
2. Every time I enter the AddSTA function - handles.STANumber is '1' (even though I prev' increased it) - On the same not - handles.PanelPosition is also in his default value.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Migrate GUIDE Apps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!