Hi everyone! I built a simple GUI with GUIDE and edited Callback function. The program is very simple: you can choose from popup-menĂ¹ if copy A to B or B to A. The first time, it works correctly, (i.e A to B or B to A), but if you want to use it again, there is an error, but I don't know why. This is a short part of the program (if you want, i can send you .m and .figure files, my e-mail is pietropp11@gmail.com):
[...] function edit1_Callback(hObject, eventdata, handles) val = str2double(get(hObject, 'String')); if isnan(val) set(hObject, 'String', 0); errordlg('Devi inserire un numero','Errore'); end handles.edit1 = val; guidata(hObject,handles) [...] function edit2_Callback(hObject, eventdata, handles) val = str2double(get(hObject, 'String')); if isnan(val) set(hObject, 'String', 0); errordlg('Devi inserire un numero','Errore'); end handles.edit2 = val; guidata(hObject,handles) [...] function pulsante_Callback(hObject, eventdata, handles) popup = get(handles.popupmenu1, 'Value'); switch popup case 1 cambio= handles.edit1; set(handles.edit2, 'String', num2str(cambio)); case 2 cambio= handles.edit2; set(handles.edit1, 'String', num2str(cambio)); end [...]
I'm sorry if my English in not very well. Best Regards
Pietro Rossi
Best Answer