Updating edit text fields in gui
显示 更早的评论
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);
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Workspace Variables and MAT Files 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!