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

2 次查看(过去 30 天)
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?

回答(1 个)

Geoff Hayes
Geoff Hayes 2016-1-16
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.

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by