Skip to content

Dashboard data export: getExportData() hook + DashboardEngine.exportData() for CSV/MAT #210

Description

@HanSur94

Problem / motivation

A dashboard can export its config and its picture, but not its data.

  • DashboardEngine.exportScript() (libs/Dashboard/DashboardEngine.m:999) writes a .m config script.
  • DashboardEngine.exportImage() (libs/Dashboard/DashboardEngine.m:1017) writes a PNG/JPEG.
  • There is no data export at the dashboard or widget level.

Yet a standalone FastSense plot already exports its underlying data to CSV/MAT via FastSenseToolbar.exportData (libs/FastSense/FastSenseToolbar.m:149). So the same plot, embedded as a FastSenseWidget in a dashboard, loses that capability — the engineer must drop out of the dashboard to get the numbers. For a MATLAB sensor-analysis workflow, pulling the visible window of a recording into CSV/MAT for a report or downstream analysis is a routine, first-class need.

This is a clean asymmetry: standalone FastSense → can export data; dashboard-embedded FastSense → cannot.

Proposed feature

An additive, opt-in data-export path that mirrors the existing dashboard export verbs and the existing widget data-access hook pattern:

  1. DashboardWidget.getExportData() — a new base method that returns [] by default (exactly like the existing getPreviewSeries() and getEventTimes() no-op hooks at libs/Dashboard/DashboardWidget.m:178 and :187). Data-bearing widgets override it to return their current series/table as a struct or table.
  2. DashboardEngine.exportData(path) — iterate the widget list, collect each widget's getExportData(), and write CSV (one file per widget, or a folder) / MAT. Sits alongside exportScript/exportImage.

Rough sketch

  • Lib/class: libs/Dashboard/DashboardWidget.m (new base hook), libs/Dashboard/DashboardEngine.m (new exportData), plus overrides on the data-bearing widgets.
  • Widget overrides:
    • FastSenseWidget — delegate to the already-resolved RenderDataCache_ (x,y) / Tag.getXYRange (no extra resolve pass).
    • TableWidget — return its backing table.
    • ScatterWidget / HistogramWidget / BarChartWidget — return their plotted arrays.
    • Non-data widgets (Divider, Text, Image, Icon…) keep the base [] and are skipped.
  • Public-API shape:
    s = widget.getExportData();      % struct/table, or [] to opt out
    d.exportData('out/');            % folder: one CSV per data-bearing widget
    d.exportData('run.mat');         % single MAT bundle
  • Format inferred from extension (matching the exportImage convention); CSV via writematrix/fprintf, MAT via save — no toolbox.

Value

High. Closes the export/report gap for the core "analyze a recording in a dashboard, then report it" workflow without forcing the engineer back to a standalone plot. Reuses data already resolved during render, so no extra cost on the refresh path.

Constraints check

  • Toolbox-free:writematrix/fprintf/save are base MATLAB/Octave.
  • Backward-compatible: ✅ Purely additive. Base hook returns [], so existing widgets, scripts, and serialized dashboards are unaffected. No change to toStruct/fromStruct.
  • Pure MATLAB/Octave:
  • Widget contract: ✅ New optional hook follows the established getPreviewSeries/getEventTimes "base returns [] to opt out" pattern; nothing required of existing subclasses.

Effort estimate

M — one base hook + one engine method + overrides on ~4–5 data-bearing widgets (FastSenseWidget delegates to its existing cache).


AI-proposed via /feature-scout — needs a human product decision before implementation.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions