Skip to content

Examples

github-actions[bot] edited this page Apr 17, 2026 · 16 revisions

Examples

FastSense includes 80+ runnable examples in the examples/ directory demonstrating features from basic plotting to advanced dashboards with real-time event detection.

Running Examples

install;           % Set up paths and compile MEX

% Run individual examples
cd examples/01-basics
example_basic      % Simple 10M-point plot with thresholds

% Batch execution
run_all_examples   % Non-interactive batch run of all 80+ examples
demo_all           % Interactive mode: ENTER between examples, keep plots open

Organized by Category

01-basics: Core Plotting

Example Points Key Features
example_basic 10M Noisy sine + upper/lower thresholds
example_multi 5×1M 5 sensors, auto color cycle, shared thresholds
example_alarm_bands 2M Industrial 4-level (HH/H/L/LL) alarm zone bands
example_nan_gaps 1M NaN dropouts with seamless gap handling
example_uneven_sampling Variable Sparse (10 Hz) + dense (10 kHz) interleaved bursts
example_vibration 20M 50 kHz accelerometer with bearing fault bursts
example_ecg 5M 1 kHz ECG with QRS, PVCs, baseline wander
example_themes 10M All 6 theme presets + 3 color palettes on same data
example_toolbar 1M Interactive toolbar: cursor, crosshair, grid, autoscale, PNG export
example_datetime 50M Datetime X-axis with auto-formatted tick labels
example_visual_features 2×2 grid Bands, shading, fills, markers, linked zoom
example_mixed_tiles 2×3 grid FastSense tiles + raw MATLAB axes (bar, scatter, histogram)
example_navigator_overlay NavigatorOverlay standalone demo for custom zoom rectangles
example_lttb_vs_minmax 5M Side-by-side LTTB vs MinMax downsampling comparison
example_linked 3×1M 3 linked subplots: zoom one, all follow
example_disk_storage 100M SQLite-backed storage for extreme-scale datasets
example_100M 100M Stress test: 100M points on single GPU

02-sensors: Sensor Model & Thresholds

Example Sensors Key Features
example_sensor_static 1 Basic static upper/lower thresholds
example_sensor_threshold 1 Dynamic thresholds (idle/run/boost modes)
example_sensor_multi_state 1 Two state channels (machine + zone) with compound conditions
example_sensor_registry N TagRegistry API: list(), get(), getMultiple()
example_sensor_dashboard 4 2×2 grid with sensors from registry
example_sensor_todisk 6 Memory-to-disk transitions, storage modes
example_multi_sensor_linked 4 4-channel dashboard with independent thresholds, linked zoom
example_dynamic_thresholds_100M 10 100M pts, state-dependent rules, composition of conditions
example_sensor_detail 1 SensorDetailPlot with dual-pane navigator + events
example_sensor_detail_basic 1 Minimal SensorDetailPlot example
example_sensor_detail_datetime 1 SensorDetailPlot with datetime axes
example_sensor_detail_dashboard 3 SensorDetailPlots in a 2×2 grid with raw FastSense tile
example_sensor_detail_dock 4 Multi-tab dock with SensorDetailPlots (correlation, overview, event analysis, trend)

03-dashboard: Dashboard Engine & Layouts

Example Widgets Key Features
example_dashboard 2×2 FastSenseGrid with bands, shading, fills, markers
example_dashboard_9tile 3×3 Large heterogeneous grid (15M+ pts), LTTB downsampling
example_dashboard_engine Mixed DashboardEngine with JSON save/load, sensor binding
example_dashboard_all_widgets 12 All 8+ widget types (FastSense, Number, Gauge, Status, Table, Timeline, Heatmap, BarChart, etc.)
example_dashboard_advanced Mixed Multi-page (addPage/switchPage), detachable widgets, DividerWidget, CollapsibleWidget, Y-axis limits, tabbed groups, JSON roundtrip, InfoFile
example_dashboard_live Mixed DashboardEngine in live mode, periodic data updates
example_dashboard_groups Grouped Panel/collapsible/tabbed GroupWidget modes
example_dashboard_info Mixed Dashboard with InfoFile linking Markdown documentation
example_dashboard_builder Mixed Edit mode with drag/resize widgets and palette
example_dock 5 tabs FastSenseDock with multi-page dashboards, datetime, metadata
example_dock_disk 35 sensors 5 tabs, 100M pts, state-dependent machine modes, recipe phases
example_dock_many_tabs 20 tabs Scrollable tab bar overflow

04-widgets: Individual Widget Demos

Each demonstrates all binding modes (Sensor, ValueFcn, StaticValue):

Widget Example Key Features
FastSense example_widget_fastsense All 4 modes + threshold toggle
Number example_widget_number Sensor/callback/static with trend auto-detection
Gauge example_widget_gauge 4 styles (arc, donut, bar, thermometer)
Status example_widget_status Threshold-driven color-coded indicator
Text example_widget_text Alignment, font sizing
Table example_widget_table Static data, callback, sensor-bound
RawAxes example_widget_rawaxes Custom MATLAB plots in dashboard tile
Heatmap example_widget_heatmap 2D grid with colormap
BarChart example_widget_barchart Vertical/horizontal, stacking
Histogram example_widget_histogram Bin count, normal-fit overlay
Scatter example_widget_scatter X/Y correlation, color-coded by third sensor
Image example_widget_image Procedural + file-based images
Timeline example_widget_timeline Event Gantt bars, filtering
IconCard example_widget_iconcard Mushroom-card icon + value + secondary label
ChipBar example_widget_chipbar Horizontal status chip bar
Sparkline example_widget_sparkline KPI card with trend + delta
Divider example_widget_divider Visual section separator

05-events: Event Detection & Visualization

Example Sensors Key Features
example_event_detection_live 3 Live detection with MockDataSource, EventViewer Gantt, console logging, linked FastSense
example_event_viewer_from_file 6 Persistent event store in .mat, auto-refresh, click-to-plot
example_live_pipeline 3 Complete pipeline: data sources, detector, store, notifications, snapshots

06-webbridge: Python & Web Integration

Example Description
example_webbridge MATLAB server: FastSense + WebBridge TCP/HTTP, background timer
example_webbridge_dashboard.html JavaScript client: plotly charts, WebSocket updates
example_webbridge_dashboard.py Python client: matplotlib, real-time refresh
mock_matlab_bridge.py Headless Python mock (test without MATLAB)

07-advanced: Stress Tests & Optimization

Example Points Key Features
example_stress_test 86M 5-tab dock, 26 sensors, dynamic state-dependent thresholds
example_100M 100M Single-line extreme scale

08: Specialized Topics

Example Topic
example_dock_disk Disk-backed SQLite storage
example_linked Synchronized zoom/pan
example_toolbar Interactive data cursor, export
example_datetime Datetime X-axis with auto-formatting
example_lttb_vs_minmax Algorithm comparison
example_themes Theme customization

Code Patterns

Minimal FastSense Plot

fp = FastSense('Theme', 'dark');
fp.addLine(x, y, 'DisplayName', 'Sensor A');
fp.addThreshold(100, 'Direction', 'upper', 'Label', 'Alarm', 'ShowViolations', true);
fp.render();

Dashboard with Sensors

d = DashboardEngine('Process Monitor');
d.addWidget('fastsense', 'Title', 'Pressure', 'Tag', tagRegistry.get('pressure_a'));
d.addWidget('number', 'Title', 'Temperature', 'Tag', tagRegistry.get('temperature'));
d.addWidget('status', 'Title', 'Motor', 'Tag', motorTag);
d.render();

Live Dashboard with Events

d = DashboardEngine('Live Monitor');
d.addWidget('fastsense', 'Tag', sensorTag);
d.addWidget('timeline', 'EventStore', eventStore);
d.render();
d.startLive([]); % Timer-driven refresh

Event Detection Pipeline

config = EventConfig();
config.addSensor('pressure_a', 'Alarm', 95, 'Warning', 85, ...
                 'AlarmOff', 90, 'MinDuration', 5);
[events, detector] = config.runDetection();
viewer = EventViewer(events, sensor.X, sensor.Y);

See Also


Generated from source code. Last updated: 2026-04-17

Clone this wiki locally