Updating edit text fields in gui
Ältere Kommentare anzeigen
I am building a gui to read data from an excel file into edit fields in my gui. I have a pushbutton to perform calculations using the values read into those edit fields. The problem is that when I change the values in the edit boxes and press the calculate button I get this error:
Error using handle.handle/get
Invalid or deleted object.
Error in testgui>pushbutton1_Callback (line 152)
a = get(handles.edit1,'String');
I would like to do the calculations with the newly entered values and write over the values already stored in the excel file. Please help this small problem is costing me time to complete other aspects of my project. I made a simple calculator gui as an illustration. Thanks in advance!
Example Code:
function pushbutton1_Callback(hObject, eventdata, handles)
a = get(handles.edit1,'String');
b = get(handles.edit2,'String');
xlswrite('myData.xls',[str2num(a) str2num(b)]);
b = xlsread('myData.xls');
set(handles.edit1,'String',b(1));
set(handles.edit2,'String',b(2));
hv = b(1)+b(2);
set(handles.text5,'String',hv);
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Workspace Variables and MAT Files finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!