A (partly templated) C++ library to handle writing simple Matlab(r) MAT file in Version "MATLAB 5.0" or higher. This 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
This software is licensed under the term of the GNU Lesser General Public License 2.1 (LGPL 2.1) or above. See licensesec for details.
Some helpful links:
Library Bindings:
The following example code writes some arrays and matrices into a MAT-file:
if (mat) {
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};
std::map<std::string, double> mp1;
mp1["x"]=100;
mp1["y"]=200;
mp1["z"]=300;
mp1["longname"]=10000*M_PI;
}
TINYMAT_EXPORT void TinyMATWriter_writeStruct(TinyMATWriterFile *mat, const char *name, const std::map< std::string, double > &data)
write a a std::map<std::string,double> into a MAT-file as a struct
TINYMAT_EXPORT TinyMATWriterFile * TinyMATWriter_open(const char *filename, const char *description=NULL, size_t bufSize=1024 *100)
create a new MAT file
TINYMAT_EXPORT void TinyMATWriter_close(TinyMATWriterFile *mat)
close a given MAT file
void TinyMATWriter_writeMatrixND_rowmajor(TinyMATWriterFile *mat, const char *name, const T *data_real, const int32_t *sizes, uint32_t ndims)
write a N-dimensional double matrix into a MAT-file
Definition tinymatwriter.h:349