You're reassigning handles.edit_box1 which loses your handle. Instead, use
x=str2double(get(handles.edit_box1,'String'));
setappdata(handles.figure1,'x',x);
and
y=str2double(get(handles.edit_box2,'String'));
setappdata(handles.figure1,'y',y);
in both the edit boxes, then in the pushbutton function use
x = getappdata(handles.figure1, 'x');
y = getappdata(handles.figure1, 'y');
c = 2*(x + y);
Best Answer