This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


(App Designer) Create gauge component

Use only with App Designer or figures created with the uifigure function. Apps created with GUIDE or the figure function do not support gauge components.


g = uigauge
g = uigauge(style)
g = uigauge(parent)
g = uigauge(parent,style)
g = uigauge(___,Name,Value)


g = uigauge creates a circular gauge in a new figure window and returns the Gauge object. MATLAB® calls the uifigure function to create the figure.

g = uigauge(style) specifies the gauge style.


g = uigauge(parent) creates the gauge in the specified parent container. The parent can be a Figure created using the uifigure function, or one of its child containers.


g = uigauge(parent,style) creates a gauge of the specified style in the specified parent container.


g = uigauge(___,Name,Value) specifies object properties using one or more Name,Value pair arguments. Use this option with any of the input argument combinations in the previous syntaxes.


collapse all

fig = uifigure;
cg = uigauge(fig);

fig = uifigure;
lg  = uigauge(fig,'linear');

Specify a panel as the parent container for a linear gauge.

fig = uifigure;
pnl = uipanel(fig);
lg = uigauge(pnl,'linear');

Create a circular gauge, and set the ScaleDirection property to specify that the needle moves counterclockwise.

fig = uifigure;
cg = uigauge(fig,'ScaleDirection','counterclockwise');

Change the number of major ticks, specify matching tick labels, and remove minor ticks.

cg.MajorTicks = [0:10:100];
cg.MajorTickLabels = {'0','10','20','30','40','50','60','70','80','90','100'};
cg.MinorTicks = [];

fig = uifigure;
cg = uigauge(fig,'ScaleColors',{'yellow','red'},...
                 'ScaleColorLimits', [60 80; 80 100]);

Input Arguments

collapse all

Style of gauge, specified as any one of the following values:


Parent container, specified as a Figure created using the uifigure function, or one of its child containers: Tab, Panel, ButtonGroup, or GridLayout.

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Each type of gauge supports a different set of properties. For a full list of properties and descriptions for each type, see the associated property page.

Introduced in R2016a