How can I save a counter after push button in GUI ?
1 次查看(过去 30 天)
显示 更早的评论
Hi ! I have this code :
function pushbutton_callback(src,event,data)
data.handles.A = [data.handles.A; data.handles.I];
end
and I would like to save my counter in data.handles.A every time I push the button but it is telling me that I have 'Not enough input arguments.' Do you know how to solde this problem ?
0 个评论
采纳的回答
Jan
2017-11-9
编辑:Jan
2017-11-9
Usually the 3rd argument of callbacks created by GUIDE is "handles". Then:
function pushbutton_callback(src,event,handles)
handles.data.A = [handles.data.A; handles.data.I];
guidata(src, handles); % Store the updated handles struct in the Application data
end
Of course it is a guess only, that you want "handles.data.A" instead of "data.handles.A". It would be more clear, what your problem is, if you post the complete error message. Most of all it would be interesting to know, which line is failing and how you have defined the callback function.
0 个评论
更多回答(1 个)
ES
2017-11-9
You have sto store this data the gui handles. You can do this by inserting
data.handles.A = [data.handles.A; data.handles.I];
% Update handles structure
guidata(hObject, handles);
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Interactive Control and Callbacks 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!