UI Inbuilt Functions

Several UI functions are available for use with uicontrol functions.

The following OML functions: uipanel, uiwait, uiresume and uitable are available to complement uicontrol capabilities.


A uipanel is a container for different graphical objects in a GUI. The objects contained in a panel are referred as children of the uipanel. Each parent uipanel can accommodate different types of child objects.

A uipanel is visually represented as a rectangle within a figure object. Try the following code to create a uipanel.

f = figure();
panel = uipanel(f,'units','normalized', 'position',[0.05 0.05 0.4 0.9]);

To understand the concept of parent and children objects, review the following example where two uipanels are created within a figure object:

f = figure();
panel1 = uipanel(f,'units','normalized','position',[0.05 0.05 0.4 0.9]);
panel2 = uipanel(f,'units','normalized','position',[0.5 0.05 0.4 0.9]);

Observe that in panel1 and panel2, the handle f is used as a reference handle. This means that both uipanels have the same parent object f.

As the figure handle acts as a parent object for uipanel, the latter acts as a parent object for different graphical widgets within it.


Note: If a uipanel is created without a figure handle, the software creates a default figure object as the parent of uipanel.

panel1 = uipanel('units','normalized','position',[0.05 0.05 0.4 0.9]);


uiwait pauses the execution for either the wait time specified or the event when the uiresume function is called.

f = figure();
msgfig = msgbox('A plot was successfully created!');
disp('Program execution resumed');

This code example shows that the execution is stopped until the resume button is pressed.


uiresume resumes the execution of a blocked program. uiresume(handle) resumes a program that a uiwait pauses.


uitable creates a table in the GUI figure.

f = figure();
table = uitable(f,'data',randn(20),'units','normalized','position',[0.1 0.1 0.4 0.5]);


Creates a tab in a tabbed frame for interactive, graphical control of objects in a figure. This command is especially useful for building complex workflows.

f = figure('Name','uitab','NumberTitle','off');
h = uitabgroup(f)
tab1 = uitab(h, 'title', 'My tab 1')
tab2 = uitab(h, 'title', 'My tab 2')


Creates a menu item for interactive graphical control of objects in a figure.

f = figure('Name','uimenu','NumberTitle','off');
function outfunc1 = func1(h,callstate) 
m1 = uimenu('label', 'Menu1');
item1_m1 = uimenuitem('parent', m1, 'label', 'Foo1', 'callback', '@func1');