GUIDE generates a myGui_OpeningFcn(hObject, eventdata, handles, varargin)
. In there, you can initialize your strings:
function myGui_OpeningFcn(hObject, eventdata, handles, varargin)
handles.output = hObject;
set(handles.popupmenu1, 'String', varargin{2});
set(handles.uitable1, 'Data', varargin{1});
set(handles.uitable1, 'ColumnName', {'a' 'b' 'c'});
set(handles.uitable1, 'RowName', {'1' '2' '3'});
guidata(hObject, handles);
end
Note the use of guidata
which updates the handle structure for the GUI with the new handles
. If you don't call guidata
whenever you change the handles
structure, the changes you've made won't be reflected.