Info
此问题已关闭。 请重新打开它进行编辑或回答。
Building a calculator, confused with GUI ButtonDownFct
1 次查看(过去 30 天)
显示 更早的评论
Hello, I am building a calculator from scratch and Im having trouble with the ButtonPressFct. I am trying to make it so I store a variable ONLY IF you press a certain button. In this case, Im trying to do it for the '+' button. Heres what I have and it is not working
function togglebutton12_Callback(hObject, eventdata, handles)
% hObject handle to togglebutton12 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of togglebutton12
global n1
if (get(handles.text1,'ButtonDownFct') ~= 'on'
n1 = get(handles.text1,'String');
else
n1 = 0;
end
textString = get(handles.text1,'String');
textString = '';
set(handles.text1,'String',textString)
0 个评论
回答(0 个)
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!