MATLAB: How to save data from a GUI edit box to table using push button

guitable

I am trying to figure out a way to import data from 3 edit boxes using 1 push button to a table. Please help me with that. I want to say thank you in advance!

Best Answer

Dang - use the handles structure that is passed in as the third parameter to the push button callback to get the handles to the three edit text controls. If the table is part of your GUI (i.e. an uitable) then you would again use the handles structure to get the table handle and use that to update the table. For example,
function pushbutton1_Callback(hObject, eventdata, handles)
% get the string data from the three edit controls
str1 = char(get(handles.edit1,'String'));
str2 = char(get(handles.edit2,'String'));
str3 = char(get(handles.edit3,'String'));
% do some work
% update the table
set(handles.uitable1,'Data',data);
where data is an mxn cell array of data that you wish to display within your table.