uigauge (App Designer)

Create circular, linear, ninety-degree, or semicircular 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.

Syntax

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

Description

g = uigauge creates a circular gauge in a new UI figure window and returns the gauge object.

g = uigauge(style) specifies the gauge style.

example

g = uigauge(parent) specifies the parent object in which to create the gauge. The parent object must be a UI figure window, or a tab, panel, or button group within a UI figure window.

example

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

example

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

Input Arguments

collapse all

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

StyleDefault Visual
'circular'
'linear'
'ninetydegree'
'semicircular'

Parent object of the gauge, specified as a figure, panel, tab, or button group object.

The parent object must be either a figure created using the uifigure function, or a tab, panel, or button group within such a figure.

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 single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

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

Examples

collapse all

fig = uifigure;
cg = uigauge(fig);

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

Specify a panel as the parent object 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]);

Introduced in R2016a

Was this topic helpful?