Filter löschen
Filter löschen

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

2 Ansichten (letzte 30 Tage)
Gee Cheng Mun
Gee Cheng Mun am 16 Jan. 2016
Beantwortet: Geoff Hayes am 16 Jan. 2016
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?

Antworten (1)

Geoff Hayes
Geoff Hayes am 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.

Kategorien

Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by