https://github.com/jkriege2/tinymat
C/C++ library to handle writing simple Matlab(r) MAT file
https://github.com/jkriege2/tinymat
cpp file-format lib mat-files matlab
Last synced: 12 days ago
JSON representation
C/C++ library to handle writing simple Matlab(r) MAT file
- Host: GitHub
- URL: https://github.com/jkriege2/tinymat
- Owner: jkriege2
- License: lgpl-2.1
- Created: 2015-07-18T11:30:51.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2024-05-21T11:29:46.000Z (11 months ago)
- Last Synced: 2025-03-26T14:41:11.180Z (30 days ago)
- Topics: cpp, file-format, lib, mat-files, matlab
- Language: C++
- Homepage: http://jkriege2.github.io/TinyMAT/
- Size: 1.22 MB
- Stars: 46
- Watchers: 1
- Forks: 22
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TinyMAT
A (partly templated) C++ library to handle writing simple Matlab(r) MAT file in Version "MATLAB 5.0" or higherThis library implements a very simple interface to write Matlab MAT file (level 5), as described in http://www.mathworks.de/help/pdf_doc/matlab/matfile_format.pdf
It is licensed under the terms of the GNU Lesser general Public license (LGPL) >=2.1
[](https://github.com/jkriege2/TinyMAT/releases)

[](http://jkriege2.github.io/TinyMAT/index.html)
[](https://github.com/jkriege2/TinyMAT/pulse)
[](https://github.com/jkriege2/TinyMAT/graphs/contributors)[](https://github.com/jkriege2/TinyMAT/issues)
[](https://github.com/jkriege2/TinyMAT/issues?q=is%3Aissue+is%3Aclosed)[](https://github.com/jkriege2/TinyMAT/pulls)
[](https://github.com/jkriege2/TinyMAT/pulls?q=is%3Apr+is%3Aclosed)[](https://github.com/jkriege2/TinyMAT/actions/workflows/build_windows.yml)
[](https://github.com/jkriege2/TinyMAT/actions/workflows/build_linux.yml)
[](https://github.com/jkriege2/TinyMAT/actions/workflows/msvc-codeanalysis.yml)
[](https://github.com/jkriege2/TinyMAT/actions/workflows/build_docs.yml)# Example
The following example code writes some arrays and matrices into a MAT-file:
```C++
TinyMATWriterFile* mat=TinyMATWriter_open("test.mat");
if (mat) {
// a 3D matrix in row-major
double mat432[4*3*2]= {
1,2,3,
4,5,6,10,20,30,
40,50,60,100,200,300,
400,500,600,1000,2000,3000,
4000,5000,6000,
};
int32_t mat432_size[3] = {3,2,4}; // columns, rows, matrices,...// a struct as a map of doubles
std::map mp1;
mp1["x"]=100;
mp1["y"]=200;
mp1["z"]=300;
mp1["longname"]=10000*M_PI;TinyMATWriter_writeStruct(mat, "struct1", mp1);
TinyMATWriter_writeMatrixND_rowmajor(mat, "matrix432", mat432, mat432_size, 3);TinyMATWriter_close(mat);
}
```# Library Bindings
* There exists a plugin for the [CImg image processing library](https://cimg.eu/), that uses TinyMATWriter: https://github.com/dtschump/CImg/blob/master/plugins/tinymatwriter.h .
# Documentation
* library docukentation: https://travis-ci.org/jkriege2/TinyMAT
* API documentation: http://jkriege2.github.io/TinyMAT/group__tinymatwriter.html
* build instructions: http://jkriege2.github.io/TinyMAT/page_buildinstructions.html
* usage instructions:http://jkriege2.github.io/TinyMAT/page_useinstructions.html## Stargazers over time
[](https://starchart.cc/jkriege2/TinyMAT)