How can I create table of fixed values in MATLAB gui?

7 views (last 30 days)
I would like to create a table of fixed values to inform the users regarding the time frame. For example, my pop-up menu have strings like 'Frame 13', 'Frame 14' and so on. How can I construct a table to inform the users that Frame 13 has a duration of 130 - 200s?

Answers (1)

Geoff Hayes
Geoff Hayes on 16 Jan 2016
Just use a uitable. For example, if your pop-up menu is named popupmenu1 and your table is named uitable1, then in the OpeningFcn of your GUI, you could do something like
function PopUpUitableExample_OpeningFcn(hObject, eventdata, handles, varargin)
handles.output = hObject;
guidata(hObject, handles);
% populate the popup menu
frameNames = {'Frame 1', 'Frame 2', 'Frame 3'};
set(handles.popupmenu1,'String',frameNames);
% populate the popup menu
frameNames = {'Frame 1'; 'Frame 2'; 'Frame 3'};
set(handles.popupmenu1,'String',frameNames);
% populate the uitable
frameSpeeds = {'0 - 25s'; '26 - 50s'; '51 - 75s'};
set(handles.uitable1,'RowName',frameNames,'Data',frameSpeeds,'ColumnName',{'Speed (seconds)'});
In the above, cell arrays of strings are used to populate both the popup menu and the uitable. See the attached for a very simple example.

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!