CLI tool to convert MATLAB v5 .mat files to CSV.
- Auto-detects three common MATLAB data layouts
- Converts MATLAB datenums to human-readable timestamps
- Batch-processes entire directories of
.matfiles - Spinner UI for progress feedback
- Combine multiple datasets into a single CSV
go install github.com/jduncan/gomat2csv@latestOr build from source:
go build -o gomat2csv .gomat2csv <file-or-dir> [file-or-dir...]
| Flag | Short | Description |
|---|---|---|
--output |
-o |
Output directory (default: same as input) |
--combine |
-c |
Combine all datasets into a single CSV |
--format |
-f |
Force format: table, cell, or auto (default: auto) |
--list |
-l |
List datasets without converting |
--version |
-v |
Print version |
Convert a single file:
gomat2csv data/PL19.matConvert all .mat files in a directory:
gomat2csv data/SOC_40%-100%_HalfC/List datasets without converting:
gomat2csv -l data/PL19.matCombine datasets into one CSV:
gomat2csv -c -o output/ data/PL19.matgomat2csv auto-detects three MATLAB data layouts:
-
Table Array — Files containing
__function_workspace__with an Nx3 cell array. Typically battery test data with MATLAB table objects embedded in workspace bytes. -
Cell-Numeric — Cell arrays whose children are numeric matrices (e.g., a 30x1 cell of 7201x5 matrices).
-
Simple Numeric — Direct numeric arrays, grouped by matching row count into datasets.
go build -o gomat2csv .
go test -v