TinyMAT
a library to write Matlab MAT-files
Tiny Matlab(r) MAT writer library
Collaboration diagram for Tiny Matlab(r) MAT writer library:

Modules

 TinyMATWriter-Support for OpenCV Datatypes
 
 TinyMATWriter-Support for Qt Datatypes
 

Functions

TINYMATWRITER_EXPORT void TinyMATWriter_close (TinyMATWriterFile *mat)
 close a given MAT file More...
 
TINYMATWRITER_EXPORT void TinyMATWriter_endCellArray (TinyMATWriterFile *mat)
 Low-Level-Interface zum Schrieben von Cell-Arrays: beendet das aktuelle Cell-Array. More...
 
TINYMATWRITER_EXPORT void TinyMATWriter_endStruct (TinyMATWriterFile *mat)
 end to write a struct-element More...
 
TINYMATWRITER_EXPORT int TinyMATWriter_fOK (const TinyMATWriterFile *mat)
 returns TRUE (non-zero) if the given TinyMATWriterFile has been opened successfully and is OK More...
 
TINYMATWRITER_EXPORT TinyMATWriterFile * TinyMATWriter_open (const char *filename, const char *description=NULL, size_t bufSize=1024 *100)
 create a new MAT file More...
 
TINYMATWRITER_EXPORT void TinyMATWriter_startCellArray (TinyMATWriterFile *mat, const char *name, const int32_t *sizes, uint32_t ndims)
 Low-Level-Interface for writing Cell-Arrays: starts a generic Cell-Array. More...
 
TINYMATWRITER_EXPORT void TinyMATWriter_startCellMatrix2D (TinyMATWriterFile *mat, const char *name, int32_t cols, int32_t rows)
 Low-Level-Interface for writing Cell-Arrays: starts a 2D Cell-Array. More...
 
TINYMATWRITER_EXPORT void TinyMATWriter_startCellVectorAsCol (TinyMATWriterFile *mat, const char *name, int32_t nitems)
 Low-Level-Interface for writing Cell-Arrays: starts a 1D Cell-Array (column) More...
 
TINYMATWRITER_EXPORT void TinyMATWriter_startCellVectorAsRow (TinyMATWriterFile *mat, const char *name, int32_t nitems)
 Low-Level-Interface for writing Cell-Arrays: starts a 1D Cell-Array (row) More...
 
TINYMATWRITER_EXPORT void TinyMATWriter_startStruct (TinyMATWriterFile *mat, const char *name)
 start to write a struct-element More...
 
template<typename T >
void TinyMATWriter_writeContainerAsColumn (TinyMATWriterFile *mat, const char *name, const T &data_vec)
 write a 1-dimensional vector/list/... of values as a column-vector into a MAT-file More...
 
template<typename T >
void TinyMATWriter_writeContainerAsColumn_internalCopy (TinyMATWriterFile *mat, const char *name, const T &data_vec)
 write a 1-dimensional vector/list/... of values as a column-vector into a MAT-file More...
 
template<typename T >
void TinyMATWriter_writeContainerAsRow (TinyMATWriterFile *mat, const char *name, const T &data_vec)
 write a 1-dimensional vector/list/... of values as a row-vector into a MAT-file More...
 
template<typename T >
void TinyMATWriter_writeContainerAsRow_internalCopy (TinyMATWriterFile *mat, const char *name, const T &data_vec)
 write a 1-dimensional vector/list/... of values as a row-vector into a MAT-file More...
 
TINYMATWRITER_EXPORT void TinyMATWriter_writeDoubleList (TinyMATWriterFile *mat, const char *name, const std::list< double > &data, bool columnVector=false)
 write a 1-dimensional std::list<double> into a MAT-file as a 1D matrix More...
 
TINYMATWRITER_EXPORT void TinyMATWriter_writeDoubleVector (TinyMATWriterFile *mat, const char *name, const std::vector< double > &data, bool columnVector=false)
 write a 1-dimensional std::vector<double> into a MAT-file as a 1D matrix More...
 
TINYMATWRITER_EXPORT void TinyMATWriter_writeEmptyMatrix (TinyMATWriterFile *mat, const char *name)
 write an empty (double) matrix into a MAT-file More...
 
template<typename T >
void TinyMATWriter_writeMatrix2D_colmajor (TinyMATWriterFile *mat, const char *name, const T *data_real, int32_t cols, int32_t rows)
 write a 2-dimensional double matrix in column-major order into a MAT-file More...
 
template<typename T >
void TinyMATWriter_writeMatrix2D_rowmajor (TinyMATWriterFile *mat, const char *name, const T *data_real, int32_t cols, int32_t rows)
 write a 2-dimensional double matrix in row-major order into a MAT-file More...
 
template<typename T >
void TinyMATWriter_writeMatrix2x2 (TinyMATWriterFile *mat, const char *name, T m11, T m12, T m21, T m22)
 write a 2x2-dimensional double matrix with entries given in row-major order directly as parameters into a MAT-file More...
 
template<typename T >
void TinyMATWriter_writeMatrix3x3 (TinyMATWriterFile *mat, const char *name, T m11, T m12, T m13, T m21, T m22, T m23, T m31, T m32, T m33)
 write a 3x3-dimensional double matrix with entries given in row-major order directly as parameters into a MAT-file More...
 
TINYMATWRITER_EXPORT void TinyMATWriter_writeMatrixND_colmajor (TinyMATWriterFile *mat, const char *name, const bool *data_real, const int32_t *sizes, uint32_t ndims)
 write a N-dimensional bool matrix in column-major form into a MAT-file More...
 
TINYMATWRITER_EXPORT void TinyMATWriter_writeMatrixND_colmajor (TinyMATWriterFile *mat, const char *name, const double *data_real, const int32_t *sizes, uint32_t ndims)
 write a N-dimensional double matrix in column-major form into a MAT-file More...
 
TINYMATWRITER_EXPORT void TinyMATWriter_writeMatrixND_colmajor (TinyMATWriterFile *mat, const char *name, const float *data_real, const int32_t *sizes, uint32_t ndims)
 write a N-dimensional float matrix in column-major form into a MAT-file More...
 
TINYMATWRITER_EXPORT void TinyMATWriter_writeMatrixND_colmajor (TinyMATWriterFile *mat, const char *name, const int16_t *data_real, const int32_t *sizes, uint32_t ndims)
 write a N-dimensional int16_t matrix in column-major form into a MAT-file More...
 
TINYMATWRITER_EXPORT void TinyMATWriter_writeMatrixND_colmajor (TinyMATWriterFile *mat, const char *name, const int32_t *data_real, const int32_t *sizes, uint32_t ndims)
 write a N-dimensional int32_t matrix in column-major form into a MAT-file More...
 
TINYMATWRITER_EXPORT void TinyMATWriter_writeMatrixND_colmajor (TinyMATWriterFile *mat, const char *name, const int64_t *data_real, const int32_t *sizes, uint32_t ndims)
 write a N-dimensional int64_t matrix in column-major form into a MAT-file More...
 
TINYMATWRITER_EXPORT void TinyMATWriter_writeMatrixND_colmajor (TinyMATWriterFile *mat, const char *name, const int8_t *data_real, const int32_t *sizes, uint32_t ndims)
 write a N-dimensional int8_t matrix in column-major form into a MAT-file More...
 
TINYMATWRITER_EXPORT void TinyMATWriter_writeMatrixND_colmajor (TinyMATWriterFile *mat, const char *name, const uint16_t *data_real, const int32_t *sizes, uint32_t ndims)
 write a N-dimensional uint16_t matrix in column-major form into a MAT-file More...
 
TINYMATWRITER_EXPORT void TinyMATWriter_writeMatrixND_colmajor (TinyMATWriterFile *mat, const char *name, const uint32_t *data_real, const int32_t *sizes, uint32_t ndims)
 write a N-dimensional uint32_t matrix in column-major form into a MAT-file More...
 
TINYMATWRITER_EXPORT void TinyMATWriter_writeMatrixND_colmajor (TinyMATWriterFile *mat, const char *name, const uint64_t *data_real, const int32_t *sizes, uint32_t ndims)
 write a N-dimensional uint64_t matrix in column-major form into a MAT-file More...
 
TINYMATWRITER_EXPORT void TinyMATWriter_writeMatrixND_colmajor (TinyMATWriterFile *mat, const char *name, const uint8_t *data_real, const int32_t *sizes, uint32_t ndims)
 write a N-dimensional uint8_t matrix in column-major form into a MAT-file More...
 
template<typename T >
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 More...
 
template<typename T >
void TinyMATWriter_writeMultiChannelMatrix2D_rowmajor (TinyMATWriterFile *mat, const char *name, const T *data_real, int32_t cols, int32_t rows, uint32_t c)
 write a N-dimensional matrix with C color channels (e.g. C=3 RGBRGBRGB...) into a MAT-file More...
 
template<typename T >
void TinyMATWriter_writeMultiChannelMatrixND_rowmajor (TinyMATWriterFile *mat, const char *name, const T *data_real, const int32_t *sizes, uint32_t ndims, uint32_t c)
 write a N-dimensional matrix with C color channels (e.g. C=3 RGBRGBRGB...) into a MAT-file More...
 
TINYMATWRITER_EXPORT void TinyMATWriter_writeString (TinyMATWriterFile *mat, const char *name, const char *data)
 write a string into a MAT-file More...
 
TINYMATWRITER_EXPORT void TinyMATWriter_writeString (TinyMATWriterFile *mat, const char *name, const char *data, uint32_t slen)
 write a string into a MAT-file More...
 
TINYMATWRITER_EXPORT void TinyMATWriter_writeString (TinyMATWriterFile *mat, const char *name, const std::string &data)
 write a string into a MAT-file More...
 
TINYMATWRITER_EXPORT void TinyMATWriter_writeStringList (TinyMATWriterFile *mat, const char *name, const std::list< std::string > &data)
 write a 1-dimensional std::list<std::string> into a MAT-file as a cell array More...
 
TINYMATWRITER_EXPORT void TinyMATWriter_writeStringVector (TinyMATWriterFile *mat, const char *name, const std::vector< std::string > &data)
 write a 1-dimensional std::vector<std::string> into a MAT-file as a cell array More...
 
TINYMATWRITER_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 More...
 
template<typename T >
void TinyMATWriter_writeValue (TinyMATWriterFile *mat, const char *name, T data_real)
 write a single (numeric) value (as 1x1 matrix) into a MAT-file More...
 
template<typename T >
void TinyMATWriter_writeVectorAsColumn (TinyMATWriterFile *mat, const char *name, const T *data_real, int32_t rows)
 write a 1-dimensional double vector as a column-vector into a MAT-file More...
 
template<typename T >
void TinyMATWriter_writeVectorAsColumn (TinyMATWriterFile *mat, const char *name, T d1, T d2)
 write a 1-dimensional double vector as a row-vector into a MAT-file with data directly as parameter direct More...
 
template<typename T >
void TinyMATWriter_writeVectorAsRow (TinyMATWriterFile *mat, const char *name, const T *data_real, int32_t rows)
 write a 1-dimensional double vector as a row-vector into a MAT-file More...
 
template<typename T >
void TinyMATWriter_writeVectorAsRow (TinyMATWriterFile *mat, const char *name, T d1, T d2)
 write a 1-dimensional double vector as a row-vector into a MAT-file with data directly as parameter direct More...
 

Detailed Description

TinyMATWriterFile* mat=TinyMATWriter_open("test.mat");
if (mat) {
double mat1[4]={1,2,3,4};
double vec1[8]={1,2,3,4,5,6,7,8};
TinyMATWriter_writeMatrix2D_rowmajor(mat, "vector1", vec1, 1,8);
TinyMATWriter_writeMatrix2D_rowmajor(mat, "matrix1", mat1, 2,2);
TinyMATWriter_writeMatrix2D_rowmajor(mat, "vector2", vec1, 8,1);
}

Here is Octave/Matlab code to test the output and create a comparable MAT-file:

mat1=[1,2;3,4];
vec1=[1,2,3,4,5,6,7,8];
vec2=vec1';
save("-v6", "./test_octave.mat", "vec1", "mat1", "vec2")
load("test.mat", "-v6")
if (vec1==vector1)
disp('vec1 OK');
end
if (mat1==matrix1)
disp('mat1 OK');
end
if (vec2==vector2)
disp('vec2 OK');
end

Function Documentation

◆ TinyMATWriter_close()

TINYMATWRITER_EXPORT void TinyMATWriter_close ( TinyMATWriterFile *  mat)

close a given MAT file

Parameters
tiffTIFF file to close

This function also releases memory allocated in TinyMATWriter_open() in tiff.

◆ TinyMATWriter_endCellArray()

TINYMATWRITER_EXPORT void TinyMATWriter_endCellArray ( TinyMATWriterFile *  mat)

Low-Level-Interface zum Schrieben von Cell-Arrays: beendet das aktuelle Cell-Array.

Parameters
matthe MAT-file to write into
namestruc the structure object to finish

◆ TinyMATWriter_endStruct()

TINYMATWRITER_EXPORT void TinyMATWriter_endStruct ( TinyMATWriterFile *  mat)

end to write a struct-element

Parameters
matthe MAT-file to write into
namestruc the structure object to finish

◆ TinyMATWriter_fOK()

TINYMATWRITER_EXPORT int TinyMATWriter_fOK ( const TinyMATWriterFile *  mat)

returns TRUE (non-zero) if the given TinyMATWriterFile has been opened successfully and is OK

Parameters
matthe MAT-file
Returns
TRUE if the file is OK and can be written to or FALSE

◆ TinyMATWriter_open()

TINYMATWRITER_EXPORT TinyMATWriterFile* TinyMATWriter_open ( const char *  filename,
const char *  description = NULL,
size_t  bufSize = 1024 *100 
)

create a new MAT file

Parameters
filenamename of the new TIFF file
descriptiondescription of the file (max. 115 characters)
bufSizesize of the IO-Buffer used for the MAT-file ... Choosing a size in the range of the final file size may improve performance! The default-size is 100kB.
Returns
a new TinyMATWriterFile pointer on success, or NULL on errors

◆ TinyMATWriter_startCellArray()

TINYMATWRITER_EXPORT void TinyMATWriter_startCellArray ( TinyMATWriterFile *  mat,
const char *  name,
const int32_t *  sizes,
uint32_t  ndims 
)

Low-Level-Interface for writing Cell-Arrays: starts a generic Cell-Array.

Parameters
matthe MAT-file to write into
namevariable name for the new array (max. len: 31 characters)
sizesnumber of entries in each dimension {rows, cols, matrices, ...}
ndimsnumber of dimensions

After a call to this function, simply use any TinyMATWriter-function to write the cell-array entires in column-major order with "name" left blanck. Finally close the array by calling TinyMATWriter_endCellArray(). You can nest severall startCellArray/endCellAray-calls.

◆ TinyMATWriter_startCellMatrix2D()

TINYMATWRITER_EXPORT void TinyMATWriter_startCellMatrix2D ( TinyMATWriterFile *  mat,
const char *  name,
int32_t  cols,
int32_t  rows 
)
inline

Low-Level-Interface for writing Cell-Arrays: starts a 2D Cell-Array.

Parameters
matthe MAT-file to write into
namevariable name for the new array (max. len: 31 characters)
colsnumber of columns in the cell array
rowsnumber of rows in the cell array

After a call to this function, simply use any TinyMATWriter-function to write the cell-array entires in column-major order with "name" left blanck. Finally close the array by calling TinyMATWriter_endCellArray(). You can nest severall startCellArray/endCellAray-calls.

◆ TinyMATWriter_startCellVectorAsCol()

TINYMATWRITER_EXPORT void TinyMATWriter_startCellVectorAsCol ( TinyMATWriterFile *  mat,
const char *  name,
int32_t  nitems 
)
inline

Low-Level-Interface for writing Cell-Arrays: starts a 1D Cell-Array (column)

Parameters
matthe MAT-file to write into
namevariable name for the new array (max. len: 31 characters)
nitemsnumber of entries in the vector

After a call to this function, simply use any TinyMATWriter-function to write the cell-array entries with "name" left blanck. Finally close the array by calling TinyMATWriter_endCellArray(). You can nest severall startCellArray/endCellAray-calls.

◆ TinyMATWriter_startCellVectorAsRow()

TINYMATWRITER_EXPORT void TinyMATWriter_startCellVectorAsRow ( TinyMATWriterFile *  mat,
const char *  name,
int32_t  nitems 
)
inline

Low-Level-Interface for writing Cell-Arrays: starts a 1D Cell-Array (row)

Parameters
matthe MAT-file to write into
namevariable name for the new array (max. len: 31 characters)
nitemsnumber of entries in the vector

After a call to this function, simply use any TinyMATWriter-function to write the cell-array entries with "name" left blanck. Finally close the array by calling TinyMATWriter_endCellArray(). You can nest severall startCellArray/endCellAray-calls.

◆ TinyMATWriter_startStruct()

TINYMATWRITER_EXPORT void TinyMATWriter_startStruct ( TinyMATWriterFile *  mat,
const char *  name 
)

start to write a struct-element

Parameters
matthe MAT-file to write into
namevariable name for the new array (max. len: 31 characters)

◆ TinyMATWriter_writeContainerAsColumn()

template<typename T >
void TinyMATWriter_writeContainerAsColumn ( TinyMATWriterFile *  mat,
const char *  name,
const T &  data_vec 
)
inline

write a 1-dimensional vector/list/... of values as a column-vector into a MAT-file

Parameters
matthe MAT-file to write into
namevariable name for the new array
data_vecthe array to write. This container has to implement the function size() and an iterator with tool-functions begin() and end(). Data-Items (T::value_type) has to be integer numbers or floats

◆ TinyMATWriter_writeContainerAsColumn_internalCopy()

template<typename T >
void TinyMATWriter_writeContainerAsColumn_internalCopy ( TinyMATWriterFile *  mat,
const char *  name,
const T &  data_vec 
)
inline

write a 1-dimensional vector/list/... of values as a column-vector into a MAT-file

Parameters
matthe MAT-file to write into
namevariable name for the new array
data_vecthe array to write. This container has to implement the function size() and an iterator with tool-functions begin() and end(). Data-Items (T::value_type) has to be integer numbers or floats
Note
This function copies the contents of the container into a temporary array, which is then saved to the file. Use TinyMATWriter_writeContainerAsColumn() to use potential performance-optimizations for some container types.

◆ TinyMATWriter_writeContainerAsRow()

template<typename T >
void TinyMATWriter_writeContainerAsRow ( TinyMATWriterFile *  mat,
const char *  name,
const T &  data_vec 
)
inline

write a 1-dimensional vector/list/... of values as a row-vector into a MAT-file

Parameters
matthe MAT-file to write into
namevariable name for the new array
data_vecthe array to write. This container has to implement the function size() and an iterator with tool-functions begin() and end()

◆ TinyMATWriter_writeContainerAsRow_internalCopy()

template<typename T >
void TinyMATWriter_writeContainerAsRow_internalCopy ( TinyMATWriterFile *  mat,
const char *  name,
const T &  data_vec 
)
inline

write a 1-dimensional vector/list/... of values as a row-vector into a MAT-file

Parameters
matthe MAT-file to write into
namevariable name for the new array
data_vecthe array to write. This container has to implement the function size() and an iterator with tool-functions begin() and end()
Note
This function copies the contents of the container into a temporary array, which is then saved to the file. Use TinyMATWriter_writeContainerAsColumn() to use potential performance-optimizations for some container types.

◆ TinyMATWriter_writeDoubleList()

TINYMATWRITER_EXPORT void TinyMATWriter_writeDoubleList ( TinyMATWriterFile *  mat,
const char *  name,
const std::list< double > &  data,
bool  columnVector = false 
)

write a 1-dimensional std::list<double> into a MAT-file as a 1D matrix

Parameters
matthe MAT-file to write into
namevariable name for the new array
datathe array to write
columnVectorif \C true, data is stored as a column vector ... otherwise as a row-vetor

◆ TinyMATWriter_writeDoubleVector()

TINYMATWRITER_EXPORT void TinyMATWriter_writeDoubleVector ( TinyMATWriterFile *  mat,
const char *  name,
const std::vector< double > &  data,
bool  columnVector = false 
)

write a 1-dimensional std::vector<double> into a MAT-file as a 1D matrix

Parameters
matthe MAT-file to write into
namevariable name for the new array
datathe array to write
columnVectorif \C true, data is stored as a column vector ... otherwise as a row-vetor

◆ TinyMATWriter_writeEmptyMatrix()

TINYMATWRITER_EXPORT void TinyMATWriter_writeEmptyMatrix ( TinyMATWriterFile *  mat,
const char *  name 
)

write an empty (double) matrix into a MAT-file

Parameters
matthe MAT-file to write into
namevariable name for the new array

◆ TinyMATWriter_writeMatrix2D_colmajor()

template<typename T >
void TinyMATWriter_writeMatrix2D_colmajor ( TinyMATWriterFile *  mat,
const char *  name,
const T *  data_real,
int32_t  cols,
int32_t  rows 
)
inline

write a 2-dimensional double matrix in column-major order into a MAT-file

Parameters
matthe MAT-file to write into
namevariable name for the new array
data_realthe array to write (in column-major order)
colsnumber of columns
rowsnumber of rows

◆ TinyMATWriter_writeMatrix2D_rowmajor()

template<typename T >
void TinyMATWriter_writeMatrix2D_rowmajor ( TinyMATWriterFile *  mat,
const char *  name,
const T *  data_real,
int32_t  cols,
int32_t  rows 
)
inline

write a 2-dimensional double matrix in row-major order into a MAT-file

Parameters
matthe MAT-file to write into
namevariable name for the new array
data_realthe array to write (in row-major order)
colsnumber of columns
rowsnumber of rows

◆ TinyMATWriter_writeMatrix2x2()

template<typename T >
void TinyMATWriter_writeMatrix2x2 ( TinyMATWriterFile *  mat,
const char *  name,
m11,
m12,
m21,
m22 
)
inline

write a 2x2-dimensional double matrix with entries given in row-major order directly as parameters into a MAT-file

Parameters
matthe MAT-file to write into
namevariable name for the new array

◆ TinyMATWriter_writeMatrix3x3()

template<typename T >
void TinyMATWriter_writeMatrix3x3 ( TinyMATWriterFile *  mat,
const char *  name,
m11,
m12,
m13,
m21,
m22,
m23,
m31,
m32,
m33 
)
inline

write a 3x3-dimensional double matrix with entries given in row-major order directly as parameters into a MAT-file

Parameters
matthe MAT-file to write into
namevariable name for the new array

◆ TinyMATWriter_writeMatrixND_colmajor() [1/11]

TINYMATWRITER_EXPORT void TinyMATWriter_writeMatrixND_colmajor ( TinyMATWriterFile *  mat,
const char *  name,
const bool *  data_real,
const int32_t *  sizes,
uint32_t  ndims 
)

write a N-dimensional bool matrix in column-major form into a MAT-file

Parameters
matthe MAT-file to write into
namevariable name for the new array
data_realthe array to write (in column-major order)
sizesnumber of entries in each dimension {rows, cols, matrices, ...}
ndimsnumber of dimensions

◆ TinyMATWriter_writeMatrixND_colmajor() [2/11]

TINYMATWRITER_EXPORT void TinyMATWriter_writeMatrixND_colmajor ( TinyMATWriterFile *  mat,
const char *  name,
const double *  data_real,
const int32_t *  sizes,
uint32_t  ndims 
)

write a N-dimensional double matrix in column-major form into a MAT-file

Parameters
matthe MAT-file to write into
namevariable name for the new array
data_realthe array to write (in column-major order)
sizesnumber of entries in each dimension {rows, cols, matrices, ...}
ndimsnumber of dimensions

◆ TinyMATWriter_writeMatrixND_colmajor() [3/11]

TINYMATWRITER_EXPORT void TinyMATWriter_writeMatrixND_colmajor ( TinyMATWriterFile *  mat,
const char *  name,
const float *  data_real,
const int32_t *  sizes,
uint32_t  ndims 
)

write a N-dimensional float matrix in column-major form into a MAT-file

Parameters
matthe MAT-file to write into
namevariable name for the new array
data_realthe array to write (in column-major order)
sizesnumber of entries in each dimension {rows, cols, matrices, ...}
ndimsnumber of dimensions

◆ TinyMATWriter_writeMatrixND_colmajor() [4/11]

TINYMATWRITER_EXPORT void TinyMATWriter_writeMatrixND_colmajor ( TinyMATWriterFile *  mat,
const char *  name,
const int16_t *  data_real,
const int32_t *  sizes,
uint32_t  ndims 
)

write a N-dimensional int16_t matrix in column-major form into a MAT-file

Parameters
matthe MAT-file to write into
namevariable name for the new array
data_realthe array to write (in column-major order)
sizesnumber of entries in each dimension {rows, cols, matrices, ...}
ndimsnumber of dimensions

◆ TinyMATWriter_writeMatrixND_colmajor() [5/11]

TINYMATWRITER_EXPORT void TinyMATWriter_writeMatrixND_colmajor ( TinyMATWriterFile *  mat,
const char *  name,
const int32_t *  data_real,
const int32_t *  sizes,
uint32_t  ndims 
)

write a N-dimensional int32_t matrix in column-major form into a MAT-file

Parameters
matthe MAT-file to write into
namevariable name for the new array
data_realthe array to write (in column-major order)
sizesnumber of entries in each dimension {rows, cols, matrices, ...}
ndimsnumber of dimensions

◆ TinyMATWriter_writeMatrixND_colmajor() [6/11]

TINYMATWRITER_EXPORT void TinyMATWriter_writeMatrixND_colmajor ( TinyMATWriterFile *  mat,
const char *  name,
const int64_t *  data_real,
const int32_t *  sizes,
uint32_t  ndims 
)

write a N-dimensional int64_t matrix in column-major form into a MAT-file

Parameters
matthe MAT-file to write into
namevariable name for the new array
data_realthe array to write (in column-major order)
sizesnumber of entries in each dimension {rows, cols, matrices, ...}
ndimsnumber of dimensions

◆ TinyMATWriter_writeMatrixND_colmajor() [7/11]

TINYMATWRITER_EXPORT void TinyMATWriter_writeMatrixND_colmajor ( TinyMATWriterFile *  mat,
const char *  name,
const int8_t *  data_real,
const int32_t *  sizes,
uint32_t  ndims 
)

write a N-dimensional int8_t matrix in column-major form into a MAT-file

Parameters
matthe MAT-file to write into
namevariable name for the new array
data_realthe array to write (in column-major order)
sizesnumber of entries in each dimension {rows, cols, matrices, ...}
ndimsnumber of dimensions

◆ TinyMATWriter_writeMatrixND_colmajor() [8/11]

TINYMATWRITER_EXPORT void TinyMATWriter_writeMatrixND_colmajor ( TinyMATWriterFile *  mat,
const char *  name,
const uint16_t *  data_real,
const int32_t *  sizes,
uint32_t  ndims 
)

write a N-dimensional uint16_t matrix in column-major form into a MAT-file

Parameters
matthe MAT-file to write into
namevariable name for the new array
data_realthe array to write (in column-major order)
sizesnumber of entries in each dimension {rows, cols, matrices, ...}
ndimsnumber of dimensions

◆ TinyMATWriter_writeMatrixND_colmajor() [9/11]

TINYMATWRITER_EXPORT void TinyMATWriter_writeMatrixND_colmajor ( TinyMATWriterFile *  mat,
const char *  name,
const uint32_t *  data_real,
const int32_t *  sizes,
uint32_t  ndims 
)

write a N-dimensional uint32_t matrix in column-major form into a MAT-file

Parameters
matthe MAT-file to write into
namevariable name for the new array
data_realthe array to write (in column-major order)
sizesnumber of entries in each dimension {rows, cols, matrices, ...}
ndimsnumber of dimensions

◆ TinyMATWriter_writeMatrixND_colmajor() [10/11]

TINYMATWRITER_EXPORT void TinyMATWriter_writeMatrixND_colmajor ( TinyMATWriterFile *  mat,
const char *  name,
const uint64_t *  data_real,
const int32_t *  sizes,
uint32_t  ndims 
)

write a N-dimensional uint64_t matrix in column-major form into a MAT-file

Parameters
matthe MAT-file to write into
namevariable name for the new array
data_realthe array to write (in column-major order)
sizesnumber of entries in each dimension {rows, cols, matrices, ...}
ndimsnumber of dimensions

◆ TinyMATWriter_writeMatrixND_colmajor() [11/11]

TINYMATWRITER_EXPORT void TinyMATWriter_writeMatrixND_colmajor ( TinyMATWriterFile *  mat,
const char *  name,
const uint8_t *  data_real,
const int32_t *  sizes,
uint32_t  ndims 
)

write a N-dimensional uint8_t matrix in column-major form into a MAT-file

Parameters
matthe MAT-file to write into
namevariable name for the new array
data_realthe array to write (in column-major order)
sizesnumber of entries in each dimension {rows, cols, matrices, ...}
ndimsnumber of dimensions

◆ TinyMATWriter_writeMatrixND_rowmajor()

template<typename T >
void TinyMATWriter_writeMatrixND_rowmajor ( TinyMATWriterFile *  mat,
const char *  name,
const T *  data_real,
const int32_t *  sizes,
uint32_t  ndims 
)
inline

write a N-dimensional double matrix into a MAT-file

Parameters
matthe MAT-file to write into
namevariable name for the new array
data_realthe array to write (in row-major order) {M1row1, M1row2, ..., M1rowC, M2row1, M2row2, ... }
sizesnumber of entries in each dimension {cols, rows, matrices, ...}
ndimsnumber of dimensions

◆ TinyMATWriter_writeMultiChannelMatrix2D_rowmajor()

template<typename T >
void TinyMATWriter_writeMultiChannelMatrix2D_rowmajor ( TinyMATWriterFile *  mat,
const char *  name,
const T *  data_real,
int32_t  cols,
int32_t  rows,
uint32_t  c 
)
inline

write a N-dimensional matrix with C color channels (e.g. C=3 RGBRGBRGB...) into a MAT-file

Parameters
matthe MAT-file to write into
namevariable name for the new array
data_realthe array to write (in row-major order) {M1row1, M1row2, ..., M1rowC, M2row1, M2row2, ... }, where each elements has the channels in order C2C2C3C1C2C3...
sizesnumber of entries in each dimension {cols, rows, matrices, ...}
ndimsnumber of dimensions
cnumber of channels

This function will actually write an ndims+1-dimensional matrix, where the outer-most dimension is the number of channels. The input data is then separated into planes!

◆ TinyMATWriter_writeMultiChannelMatrixND_rowmajor()

template<typename T >
void TinyMATWriter_writeMultiChannelMatrixND_rowmajor ( TinyMATWriterFile *  mat,
const char *  name,
const T *  data_real,
const int32_t *  sizes,
uint32_t  ndims,
uint32_t  c 
)
inline

write a N-dimensional matrix with C color channels (e.g. C=3 RGBRGBRGB...) into a MAT-file

Parameters
matthe MAT-file to write into
namevariable name for the new array
data_realthe array to write (in row-major order) {M1row1, M1row2, ..., M1rowC, M2row1, M2row2, ... }, where each elements has the channels in order C2C2C3C1C2C3...
sizesnumber of entries in each dimension {cols, rows, matrices, ...}
ndimsnumber of dimensions
cnumber of channels

This function will actually write an ndims+1-dimensional matrix, where the outer-most dimension is the number of channels. The input data is then separated into planes!

◆ TinyMATWriter_writeString() [1/3]

TINYMATWRITER_EXPORT void TinyMATWriter_writeString ( TinyMATWriterFile *  mat,
const char *  name,
const char *  data 
)

write a string into a MAT-file

Parameters
matthe MAT-file to write into
namevariable name for the new array
datathe string to write

◆ TinyMATWriter_writeString() [2/3]

TINYMATWRITER_EXPORT void TinyMATWriter_writeString ( TinyMATWriterFile *  mat,
const char *  name,
const char *  data,
uint32_t  slen 
)

write a string into a MAT-file

Parameters
matthe MAT-file to write into
namevariable name for the new array
datathe string to write
slenlength of the string in bytes

◆ TinyMATWriter_writeString() [3/3]

TINYMATWRITER_EXPORT void TinyMATWriter_writeString ( TinyMATWriterFile *  mat,
const char *  name,
const std::string &  data 
)

write a string into a MAT-file

Parameters
matthe MAT-file to write into
namevariable name for the new array
datathe string to write

◆ TinyMATWriter_writeStringList()

TINYMATWRITER_EXPORT void TinyMATWriter_writeStringList ( TinyMATWriterFile *  mat,
const char *  name,
const std::list< std::string > &  data 
)

write a 1-dimensional std::list<std::string> into a MAT-file as a cell array

Parameters
matthe MAT-file to write into
namevariable name for the new array
datathe array to write

◆ TinyMATWriter_writeStringVector()

TINYMATWRITER_EXPORT void TinyMATWriter_writeStringVector ( TinyMATWriterFile *  mat,
const char *  name,
const std::vector< std::string > &  data 
)

write a 1-dimensional std::vector<std::string> into a MAT-file as a cell array

Parameters
matthe MAT-file to write into
namevariable name for the new array
datathe array to write

◆ TinyMATWriter_writeStruct()

TINYMATWRITER_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

Parameters
matthe MAT-file to write into
namevariable name for the new array
datathe array to write
columnVectorif \C true, data is stored as a column vector ... otherwise as a row-vetor

◆ TinyMATWriter_writeValue()

template<typename T >
void TinyMATWriter_writeValue ( TinyMATWriterFile *  mat,
const char *  name,
data_real 
)
inline

write a single (numeric) value (as 1x1 matrix) into a MAT-file

Parameters
matthe MAT-file to write into
namevariable name for the new array
data_realthe value to write

◆ TinyMATWriter_writeVectorAsColumn() [1/2]

template<typename T >
void TinyMATWriter_writeVectorAsColumn ( TinyMATWriterFile *  mat,
const char *  name,
const T *  data_real,
int32_t  rows 
)
inline

write a 1-dimensional double vector as a column-vector into a MAT-file

Parameters
matthe MAT-file to write into
namevariable name for the new array
data_realthe array to write (in row-major order)
colsnumber of columns
rowsnumber of rows

◆ TinyMATWriter_writeVectorAsColumn() [2/2]

template<typename T >
void TinyMATWriter_writeVectorAsColumn ( TinyMATWriterFile *  mat,
const char *  name,
d1,
d2 
)
inline

write a 1-dimensional double vector as a row-vector into a MAT-file with data directly as parameter direct

Parameters
matthe MAT-file to write into
namevariable name for the new array
d1first entry
d2second entry

◆ TinyMATWriter_writeVectorAsRow() [1/2]

template<typename T >
void TinyMATWriter_writeVectorAsRow ( TinyMATWriterFile *  mat,
const char *  name,
const T *  data_real,
int32_t  rows 
)
inline

write a 1-dimensional double vector as a row-vector into a MAT-file

Parameters
matthe MAT-file to write into
namevariable name for the new array
data_realthe array to write (in row-major order)
colsnumber of columns
rowsnumber of rows

◆ TinyMATWriter_writeVectorAsRow() [2/2]

template<typename T >
void TinyMATWriter_writeVectorAsRow ( TinyMATWriterFile *  mat,
const char *  name,
d1,
d2 
)
inline

write a 1-dimensional double vector as a row-vector into a MAT-file with data directly as parameter direct

Parameters
matthe MAT-file to write into
namevariable name for the new array
d1first entry
d2second entry
TinyMATWriter_open
TINYMATWRITER_EXPORT TinyMATWriterFile * TinyMATWriter_open(const char *filename, const char *description=NULL, size_t bufSize=1024 *100)
create a new MAT file
TinyMATWriter_close
TINYMATWRITER_EXPORT void TinyMATWriter_close(TinyMATWriterFile *mat)
close a given MAT file
TinyMATWriter_writeMatrix2D_rowmajor
void TinyMATWriter_writeMatrix2D_rowmajor(TinyMATWriterFile *mat, const char *name, const T *data_real, int32_t cols, int32_t rows)
write a 2-dimensional double matrix in row-major order into a MAT-file
Definition: tinymatwriter.h:504