Skip to content

matlab/matlab-agentic-toolkit / skills-catalog/test-and-measurement/matlab-build-industrial-hmi

matlab-build-industrial-hmi

Verified

Build industrial-grade SCADA/HMI dashboards in MATLAB following industrial-HMI conventions (ISA-101-aligned): gray-field philosophy, alarms at source, write safeguards, fixed-range trends, drill-down layout. Produces a real App Designer app (.mlapp, or plain-text .m+.xml on R2026b+) by handing serialization to the matlab-build-app skill when available, and falls back to a programmatic .m app otherwise. Use when wrapping OPC UA / Modbus / MQTT / OSI PI / PI AF monitoring scripts into a live operator app, building plant overviews, designing operator dashboards, or any time a user asks for a "SCADA dashboard", "HMI", "plant dashboard", "operator screen", or "industrial monitoring app" in MATLAB. Trigger on: SCADA, HMI, industrial dashboard, plant overview, operator screen, uigauge, uilamp, alarm banner, gray-field, ISA-101, OPC UA dashboard, setpoint, write safeguards, alarm visualization, OSIsoft PI, AVEVA PI, PI Server, PI Data Archive, PI AF, PI Asset Framework, piclient, afclient.

references/widget-selection-flowchart.md

View on GitHub
# Widget Selection Flowchart

Use this when picking widgets for a list of OPC UA nodes (or Modbus / MQTT items). Walk every node through the decision tree and check the result against the quantity caps.

## Decision tree

```
For each node:

  Is the data binary (2 states — on/off, open/closed, running/stopped)?
    YES → uilamp + adjacent uilabel
    NO  ↓

  Is it enumerated (3+ states — Idle/Running/Fault/Maintenance)?
    YES → styled uilabel with colored background
    NO  ↓

  Is the node writable (operator setpoint or command)?
    YES → uispinner or uieditfield('numeric') + Limits + Send button
          (See references/write-safeguards-reference.md)
    NO  ↓

  Does the node have a defined min/max range AND fit on the screen?
    YES → Is the user's goal "monitor at a glance"?
            YES → uigauge ('semicircular' single KPI, 'linear' for side-by-side rows)
                  ⚠ If the node has alarm thresholds (LL/L/H/HH) → key `ScaleColors`/
                  `ScaleColorLimits` to them (any gauge style) and set `Limits` to cover every band.
            NO  → uieditfield('numeric','Editable',false) for precise reading
    NO  ↓

  Did the user say "monitor", "track", "trend", or "over time"?
    YES → uiaxes + animatedline
          (See references/trend-config-reference.md)
    NO  ↓

  Are there more than 8 similar nodes to display together?
    YES → uitable with conditional row coloring
    NO  → uiaxes + animatedline (default to trend)
```

## Widget-by-data-type quick reference

### Analog values

| Condition | Widget | Notes |
|-----------|--------|-------|
| Single value, known range, glance-monitoring | `uigauge('linear')` or `uigauge('semicircular')` | `Limits` = sensor spec range, not observed range. Prefer `'linear'` (the default): a row of linear indicators lets the operator compare values and spot an outlier at a glance, which round dials make harder (High Performance HMI practice). `'semicircular'` suits a lone KPI. Both support `ScaleColors`/`ScaleColorLimits`; bands outside `Limits` are silently clipped, so the spec range must cover every threshold. |
| Single value, trend matters more than current reading | `uiaxes` + `animatedline` | Set `MaximumNumPoints` from `WindowSeconds / UpdatePeriod` |
| Single value, precise digits matter (setpoints, calculated outputs) | `uieditfield('numeric','Editable',false)` | `ValueDisplayFormat` for units and precision |
| Setpoint + actual shown together | Gauge with setpoint marker (yline overlay) OR adjacent numeric pair | Operator must see deviation without mental math |
| Multiple same-unit values for comparison | Horizontal `uigauge('linear')` row OR grouped bar | Enables rank-ordering and outlier spotting |
| Multiple different-unit values | Separate trends OR `yyaxis` plot | Never mix units on one axis |

### Discrete / binary values

| Condition | Widget | Notes |
|-----------|--------|-------|
| Binary (running/stopped, open/closed) | `uilamp` + adjacent `uilabel` | Lamp `Color` follows state; never color-only — pair with the label text |
| Enumerated (3+ states) | `uilabel` with `BackgroundColor` keyed to state | Text disambiguates; color reinforces |
| Writable command toggle (start/stop, enable/disable) | `uiswitch` or `uistatebutton` + `uiconfirm` | Confirmation is mandatory for actuation |

### Collections

| Condition | Widget | Notes |
|-----------|--------|-------|
| >8 monitored nodes | `uitable` with conditional row coloring | Pick which to plot via row-click callback |
| ≤8 nodes, all analog, same context | Grid of gauges OR overlaid trends with legend | Direct visual comparison without scrolling |
| Hierarchical equipment structure | `uitree` + `uitreenode` | Mirrors OPC UA namespace; never use a flat list |

## Quantity caps per screen

| Widget type | Max | If exceeded |
|-------------|-----|-------------|
| Gauges | 6 | Switch to `uitable` + selectable trend |
| Trend plots (separate axes) | 4 | Tabbed panels OR overlay with legend |
| Status lamps | 20 | Group into a status grid or summary indicator |
| Numeric displays | 12 | Use a `uitable` instead |
| Alarm banners | 1 (priority-based) | Stack into an alarm list on the detail screen |

## Like-typed analogs in the same panel must use like widgets

If the panel shows multiple analog nodes of the same kind (all temperatures, all pressures), use the **same** widget for all of them. Don't show one as a gauge and another as a numeric label — the inconsistency forces operators to switch reading modes.

```matlab
% BAD: ConveyorSpeed and ConveyorTorque side by side, different widgets
% conveyorSpeedGauge  = uigauge(panel, 'linear', 'Limits', [0 1.5]);
% conveyorTorqueLabel = uilabel(panel, 'Text', '12.4 Nm');

% GOOD: both as gauges
conveyorSpeedGauge  = uigauge(panel, 'linear', 'Limits', [0 1.5]);
conveyorTorqueGauge = uigauge(panel, 'linear', 'Limits', [0 50]);
```

## Mini code patterns

### Status lamp + label

```matlab
gl   = uigridlayout(panel, [1 2], 'ColumnWidth', {30, '1x'});
lamp = uilamp(gl, 'Color', [0.5 0.5 0.5]);   % gray = unknown/idle
lbl  = uilabel(gl, 'Text', 'Idle', 'FontWeight', 'bold');

% State change handler (e.g., from subscription callback).
% Blue for running, red for fault — never green for "running".
%   lamp.Color = [0.4 0.6 1.0]; lbl.Text = 'Running';
%   lamp.Color = [0.85 0 0];    lbl.Text = 'Fault';
```

### Multi-state badge (enumerated label)

```matlab
badge = uilabel(panel, ...
    'Text',             'IDLE', ...
    'BackgroundColor',  [0.5 0.5 0.5], ...
    'FontColor',        [1 1 1], ...
    'FontWeight',       'bold', ...
    'HorizontalAlignment', 'center');

% On state change: set both Text and BackgroundColor.
% Blue for running, red for fault — never green for "running".
%   badge.Text = 'RUNNING'; badge.BackgroundColor = [0.4 0.6 1.0];
%   badge.Text = 'FAULT';   badge.BackgroundColor = [0.85 0 0];
```

### Read-only numeric display

```matlab
val = uieditfield(panel, 'numeric', ...
    'Editable',           'off', ...
    'ValueDisplayFormat', '%.2f bar', ...
    'BackgroundColor',    [0.86 0.86 0.86], ...
    'HorizontalAlignment','right');
```

### Table for >8 nodes

```matlab
nodeTable = uitable(panel, ...
    'ColumnName',  {'Node','Value','Units','State','Updated'}, ...
    'RowStriping', 'off', ...
    'BackgroundColor', [0.86 0.86 0.86], ...
    'ForegroundColor', [0.10 0.10 0.10]);   % NOT FontColor — see common-mistakes.md entry 28

% Conditional row coloring (set in update callback):
%   s = uistyle('BackgroundColor',[0.85 0 0],'FontColor',[1 1 1]);   % uistyle DOES take FontColor
%   addStyle(nodeTable, s, 'row', alarmedRows);
```

----

Copyright 2026 The MathWorks, Inc.

----
brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).Stars: 322kUpdated Claude CodeCodexVerifiedInstall
brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).Stars: 198kUpdated Claude CodeCodexVerifiedInstall