Sei sulla pagina 1di 1

Edit text Edit text

Edit text
Tag: txt1 Tag: txt2
Tag: txt3
String: “” String: “”
String: “”

Static text
Static text
String: “+”
String: “=”

Pushbutton

String: “Salir”

Tag: salirButton

Codigo salirButton
function salirButton_Callback(hObject, eventdata, handles)
Pushbutton % hObject handle to salirButton (see GCBO)
Pushbutton
% eventdata reserved - to be defined in a future version
String: “Sumar” of MATLAB
String: “Borrar”
% handles structure with handles and user data (see
Tag: sumarButton GUIDATA)
Tag: borrarButton
opc=questdlg('¿Desea salir?', 'Salir','Si','No','No');
if strcmp(opc,'No')
return;
Codigo sumarButton end
function sumarButton_Callback(hObject, eventdata, handles) clear all, clc, close all;
% hObject handle to sumarButton (see GCBO)
% eventdata reserved - to be defined in a future version
of MATLAB
% handles structure with handles and user data (see
GUIDATA) Codigo borrarButton
n1= str2double(get(handles.txt1,'string'));
function borrarButton_Callback(hObject, eventdata, handles)
n2= str2double(get(handles.txt2,'string'));
% hObject handle to borrarButton (see GCBO)
r=n1+n2;
% eventdata reserved - to be defined in a future version
set(handles.txt3,'string',r);
of MATLAB
% handles structure with handles and user data (see
GUIDATA)
lim=' ';
set(handles.txt1,'string',lim);
set(handles.txt2,'string',lim);
set(handles.txt3,'string',lim);

Potrebbero piacerti anche