-
Notifications
You must be signed in to change notification settings - Fork 0
Installation
- MATLAB R2020b+ or GNU Octave 7+
-
C compiler (optional, for MEX acceleration):
- macOS: Xcode Command Line Tools (
xcode-select --install) - Linux: GCC (
apt install build-essential) - Windows: MSVC (included with MATLAB)
- macOS: Xcode Command Line Tools (
- No toolbox dependencies — pure MATLAB/Octave with optional C acceleration
| Platform | Architecture | SIMD Support | Status |
|---|---|---|---|
| macOS 12+ | Apple Silicon (arm64) | NEON | ✅ Tested |
| macOS 10.13+ | Intel x86_64 | AVX2/SSE2 | ✅ Tested |
| Ubuntu 18.04+ | x86_64 | AVX2/SSE2 | ✅ Tested |
| Windows 10+ | x86_64 | AVX2/SSE2 | ✅ Tested |
| Raspberry Pi OS | armv7l | NEON (limited) |
cd /path/to/FastPlot
installThis command:
- Adds five library paths (FastSense, SensorThreshold, EventDetection, Dashboard, WebBridge)
- Verifies core classes are accessible
- Performs JIT warmup on first run
- Is safe to run multiple times (idempotent)
Run the test suite:
addpath tests
run_all_testsExpected output:
================== Test Summary ====================
Totals: 450 Passed, 0 Failed, 2 Skipped
===================================================
Or run a quick example:
example_basicIf installing the Python WebBridge client in isolation:
pip install fastsense-bridge
fastsense-bridge --matlab-port 9000 --http-port 8000Requires: Python 3.11+, FastAPI, uvicorn, websockets, numpy
Clone and set up from the repository:
git clone https://github.com/mathworks/FastPlot.git
cd FastPlotThen in MATLAB/Octave:
installBuild and run FastPlot in a containerized environment:
docker build -t fastsense:latest .
docker run -it --rm fastsense:latest matlab -r "install; example_basic"Includes:
- MATLAB R2025b runtime
- GCC and build tools
- Pre-compiled MEX binaries for Linux x86_64
To access the web bridge:
docker run -p 8000:8000 -p 9000:9000 fastsense:latest bash
# Inside container:
matlab -r "install; pb = WebBridge(); pb.serve(9000, 8000)"For air-gapped environments:
-
On connected machine:
git clone https://github.com/mathworks/FastPlot.git cd FastPlot tar -czf FastPlot-offline.tar.gz .
-
Transfer
FastPlot-offline.tar.gzto target system -
On target machine:
tar -xzf FastPlot-offline.tar.gz cd FastPlot matlab -r "install"
Enable C acceleration with SIMD intrinsics for 3–50x faster downsampling:
cd libs/FastSense
build_mexThe build script will:
-
Auto-detect architecture:
Architecture: x86_64 Detected SIMD: AVX2 -
Compile four MEX files:
Compiling binary_search_mex.c ... [✓] Compiling minmax_core_mex.c ... [✓] Compiling lttb_core_mex.c ... [✓] Compiling violation_cull_mex.c ... [✓] -
Test for regressions:
MEX parity check: All tests passed [✓]
Supported architectures:
-
x86_64 (Intel/AMD): Tries AVX2 first (
-mavx2 -mfma), falls back to SSE2 (-msse2) - arm64 (Apple Silicon, AWS Graviton): NEON enabled by default
- armv7l (Raspberry Pi): Falls back to scalar C (no SIMD)
Compiler selection:
- MATLAB: Uses system compiler (MSVC on Windows, GCC/Clang on Unix)
- Octave: Uses available GCC/Clang
Troubleshooting compilation:
If build_mex fails, pure-MATLAB fallbacks remain active:
% Verify fallback is working
[x, y] = minmax_downsample([1:1e6], randn(1,1e6), 100);
disp("Downsampling works (MEX or MATLAB)");Check which path is active:
exist('minmax_core_mex', 'file') % Returns 0 if not compiledIntel:
install % Auto-detects AVX2
build_mex % Compiles with -mavx2Apple Silicon:
install
build_mex % Auto-detects NEONIf using non-official MATLAB (e.g., Octave via Homebrew):
brew install octave
cd /path/to/FastPlot
octave --eval "install; build_mex"Install build tools:
sudo apt update
sudo apt install build-essentialThen in MATLAB/Octave:
install
build_mexMATLAB includes MSVC; no additional tools needed:
install
build_mexFor GNU Octave on Windows, install MinGW:
choco install mingw # via ChocolateyThen run:
install
build_mexPre-built image with MEX compiled for Linux x86_64:
docker run -it mathworks/fastsense:latest
matlab -r "install; example_basic"To build custom image:
FROM mathworks/matlab:r2025b
RUN apt-get update && apt-get install -y build-essential
COPY . /root/FastPlot
WORKDIR /root/FastPlot
RUN matlab -r "install; build_mex; exit"Install the optional Python bridge for web-based visualization:
# From PyPI
pip install fastsense-bridge
# From source
cd bridge/python
pip install -e .Dependencies:
- Python 3.11+
- FastAPI, uvicorn, websockets, numpy
Quick start:
In MATLAB:
install
pb = WebBridge();
pb.serve(9000); % Listen on port 9000In Python (separate terminal):
fastsense-bridge --matlab-port 9000 --http-port 8000
# Open http://localhost:8000 in browserinstall
s = Sensor('test'); % SensorThreshold library
e = Event(0, 1, 'sensor', 'threshold', 'high'); % EventDetection library
fp = FastSense(); % FastSense library
de = DashboardEngine(); % Dashboard libraryExpected: No errors, four objects created.
x = linspace(0, 100, 1e6);
y = sin(x);
fp = FastSense();
fp.addLine(x, y);
fp.render();Expected: Figure appears with smooth sine wave, zoom/pan is fluid.
fprintf("MinMax MEX: %s\n", iif(exist('minmax_core_mex','file')==3, "✓ Compiled", "⚠ Fallback"));
fprintf("LTTB MEX: %s\n", iif(exist('lttb_core_mex','file')==3, "✓ Compiled", "⚠ Fallback"));
fprintf("BinSearch MEX: %s\n", iif(exist('binary_search_mex','file')==3, "✓ Compiled", "⚠ Fallback"));Expected: Either "✓ Compiled" for all (if build_mex succeeded) or "⚠ Fallback" for all (pure MATLAB).
addpath tests
results = run_all_tests();
fprintf("\nSummary: %d passed, %d failed\n", ...
results.NumPassed, results.NumFailed);Expected: All tests pass (skipped tests on Octave are normal).
Run 3+ examples to verify end-to-end functionality:
example_basic % 10M points, threshold, violations
example_dashboard % Multi-tile grid layout
example_sensor_registry % State-dependent thresholds
example_event_detection_live % Live event monitoringExpected: Figures appear, interactive zoom/pan works, no errors.
Cause: Libraries not added to path.
Fix:
cd /path/to/FastPlot
install % Re-run to ensure paths are setExpected behavior — pure-MATLAB fallback is used automatically. No action needed unless you want MEX acceleration:
build_mex % Compile MEXCause: Compiler doesn't support AVX2 (very old CPU or cross-compilation).
Fix: Fallback to SSE2 or scalar:
mex -v COMPFLAGS='$COMPFLAGS -msse2' libs/FastSense/private/mex_src/minmax_core_mex.cOr accept pure-MATLAB mode (no MEX), which is fully functional.
Cause: Old MATLAB version (< R2020b).
Fix: Upgrade MATLAB or use GNU Octave 7+.
Cause: MEX files compiled for MATLAB don't load in Octave (or vice versa).
Fix: Recompile for Octave:
pkg load signal % Load Octave packages
system("cd libs/FastSense && mkoctfile --mex private/mex_src/minmax_core_mex.c -o private/minmax_core_mex.mex")Or run in pure-MATLAB mode (no MEX).
After installation, these settings control performance:
% Get current defaults
defaults = FastSenseDefaults();
disp(defaults.MinPointsForDownsample); % Threshold for downsampling
disp(defaults.DownsampleFactor); % Points per pixel (lower = sharper)
disp(defaults.DefaultDownsampleMethod); % 'minmax' or 'lttb'Key parameters:
| Parameter | Default | Effect |
|---|---|---|
MinPointsForDownsample |
5000 | Lines with fewer points skip downsampling |
DownsampleFactor |
2 | Target 2 points per pixel; increase for coarser, faster rendering |
DefaultDownsampleMethod |
'minmax' |
'minmax' (fast, preserves extrema) or 'lttb' (shape-preserving) |
PyramidReduction |
100 | Multi-resolution pyramid reduction factor (balance memory vs. zoom-out speed) |
To customize globally:
% Create custom defaults file
% (in libs/FastSense/private/FastSenseDefaults.m, edit the struct)
clearDefaultsCache % Invalidate cache
defaults = FastSenseDefaults() % ReloadTo remove FastPlot from your MATLAB/Octave path:
rmpath(genpath('/path/to/FastPlot/libs'));
rmpath(genpath('/path/to/FastPlot/tests'));
rmpath(genpath('/path/to/FastPlot/examples'));Or restart MATLAB/Octave (paths are not persisted across sessions).
To clean up compiled MEX files:
cd /path/to/FastPlot/libs/FastSense/private
rm -f *.mex* *.o *.so *.dylibFor the full stack (MATLAB + WebBridge + web UI):
# docker-compose.yml
version: '3.8'
services:
matlab:
image: mathworks/matlab:r2025b
volumes:
- ./FastPlot:/root/FastPlot
ports:
- "9000:9000"
command: >
matlab -r "
cd /root/FastPlot;
install;
pb = WebBridge();
pb.serve(9000, 8000);
"
web:
build: ./bridge/web
ports:
- "8000:8000"
environment:
- MATLAB_HOST=matlab
- MATLAB_PORT=9000
depends_on:
- matlabRun with:
docker-compose up
# Open http://localhost:8000-
API Reference: See
wiki/API-Reference-*.md -
Examples:
examples/directory (80+ runnable scripts) -
Getting Started:
wiki/Getting-Started.md -
Performance:
wiki/Performance.md - GitHub Issues: Submit bugs and feature requests
- Discussions: Community support forum
FastSense Wiki
API Reference
Guides
Use Cases
Internals
Resources