Data Structures | |
struct | ComplexSplit |
Complex data type using split storage. More... | |
struct | mat_t |
Matlab MAT File information. More... | |
struct | matvar_t |
Matlab variable information. More... | |
struct | sparse_t |
sparse data information More... | |
Files | |
file | inflate.c |
Functions to inflate data/tags. | |
file | io.c |
file | mat.c |
file | mat4.c |
file | mat5.c |
file | matio.h |
file | read_data.c |
Enumerations | |
enum | { BY_NAME = 1, BY_INDEX = 2 } |
enum | mat_acc { MAT_ACC_RDONLY = 1, MAT_ACC_RDWR = 2 } |
MAT file access types. More... | |
enum | mat_ft { MAT_FT_MAT5 = 1, MAT_FT_MAT4 = 1 << 16 } |
MAT file versions. More... | |
enum | matio_classes { MAT_C_CELL = 1, MAT_C_STRUCT = 2, MAT_C_OBJECT = 3, MAT_C_CHAR = 4, MAT_C_SPARSE = 5, MAT_C_DOUBLE = 6, MAT_C_SINGLE = 7, MAT_C_INT8 = 8, MAT_C_UINT8 = 9, MAT_C_INT16 = 10, MAT_C_UINT16 = 11, MAT_C_INT32 = 12, MAT_C_UINT32 = 13, MAT_C_INT64 = 14, MAT_C_UINT64 = 15, MAT_C_FUNCTION = 16 } |
Matlab variable classes. More... | |
enum | matio_compression { COMPRESSION_NONE = 0, COMPRESSION_ZLIB = 1 } |
Matlab compression options. More... | |
enum | matio_flags { MAT_F_COMPLEX = 0x0800, MAT_F_GLOBAL = 0x0400, MAT_F_LOGICAL = 0x0200, MAT_F_CLASS_T = 0x00ff } |
Matlab array flags. More... | |
enum | matio_types { MAT_T_UNKNOWN = 0, MAT_T_INT8 = 1, MAT_T_UINT8 = 2, MAT_T_INT16 = 3, MAT_T_UINT16 = 4, MAT_T_INT32 = 5, MAT_T_UINT32 = 6, MAT_T_SINGLE = 7, MAT_T_DOUBLE = 9, MAT_T_INT64 = 12, MAT_T_UINT64 = 13, MAT_T_MATRIX = 14, MAT_T_COMPRESSED = 15, MAT_T_UTF8 = 16, MAT_T_UTF16 = 17, MAT_T_UTF32 = 18, MAT_T_STRING = 20, MAT_T_CELL = 21, MAT_T_STRUCT = 22, MAT_T_ARRAY = 23, MAT_T_FUNCTION = 24 } |
Matlab data types. More... | |
Functions | |
int | Mat_CalcSingleSubscript (int rank, int *dims, int *subs) |
Calculate a single subscript from a set of subscript values. | |
int * | Mat_CalcSubscripts (int rank, int *dims, int index) |
Calculate a set of subscript values from a single(linear) subscript. | |
int | Mat_Close (mat_t *mat) |
Closes an open Matlab MAT file. | |
mat_t * | Mat_Create (const char *matname, const char *hdr_str) |
Creates a new Matlab MAT file. | |
mat_t * | Mat_Open (const char *matname, int mode) |
Opens an existing Matlab MAT file. | |
int | Mat_Rewind (mat_t *mat) |
Rewinds a Matlab MAT file to the first variable. | |
size_t | Mat_SizeOfClass (int class_type) |
Returns the size of a Matlab Class. | |
int | Mat_VarAddStructField (matvar_t *matvar, matvar_t **fields) |
Adds a field to a structure. | |
matvar_t * | Mat_VarCalloc (void) |
Allocates memory for a new matvar_t and initializes all the fields. | |
matvar_t * | Mat_VarCreate (const char *name, int class_type, int data_type, int rank, int *dims, void *data, int opt) |
Creates a MAT Variable with the given name and (optionally) data. | |
int | Mat_VarDelete (mat_t *mat, char *name) |
Deletes a variable from a file. | |
matvar_t * | Mat_VarDuplicate (const matvar_t *in, int opt) |
Duplicates a matvar_t structure. | |
void | Mat_VarFree (matvar_t *matvar) |
Frees all the allocated memory associated with the structure. | |
matvar_t * | Mat_VarGetCell (matvar_t *matvar, int index) |
Returns a pointer to the Cell array at a specific index. | |
matvar_t ** | Mat_VarGetCells (matvar_t *matvar, int *start, int *stride, int *edge) |
Indexes a cell array. | |
matvar_t ** | Mat_VarGetCellsLinear (matvar_t *matvar, int start, int stride, int edge) |
Indexes a cell array. | |
int | Mat_VarGetNumberOfFields (matvar_t *matvar) |
Returns the number of fields in a structure variable. | |
size_t | Mat_VarGetSize (matvar_t *matvar) |
Calculates the size of a matlab variable in bytes. | |
matvar_t * | Mat_VarGetStructField (matvar_t *matvar, void *name_or_index, int opt, int index) |
Finds a field of a structure. | |
matvar_t * | Mat_VarGetStructs (matvar_t *matvar, int *start, int *stride, int *edge, int copy_fields) |
Indexes a structure. | |
matvar_t * | Mat_VarGetStructsLinear (matvar_t *matvar, int start, int stride, int edge, int copy_fields) |
Indexes a structure. | |
void | Mat_VarPrint (matvar_t *matvar, int printdata) |
Prints the variable information. | |
matvar_t * | Mat_VarRead (mat_t *mat, char *name) |
Reads the variable with the given name from a MAT file. | |
int | Mat_VarReadData (mat_t *mat, matvar_t *matvar, void *data, int *start, int *stride, int *edge) |
Reads MAT variable data from a file. | |
int | Mat_VarReadDataAll (mat_t *mat, matvar_t *matvar) |
Reads all the data for a matlab variable. | |
int | Mat_VarReadDataLinear (mat_t *mat, matvar_t *matvar, void *data, int start, int stride, int edge) |
Reads MAT variable data from a file. | |
matvar_t * | Mat_VarReadInfo (mat_t *mat, char *name) |
Reads the information of a variable with the given name from a MAT file. | |
matvar_t * | Mat_VarReadNext (mat_t *mat) |
Reads the next variable in a MAT file. | |
matvar_t * | Mat_VarReadNextInfo (mat_t *mat) |
Reads the information of the next variable in a MAT file. | |
int | Mat_VarWrite (mat_t *mat, matvar_t *matvar, int compress) |
Writes the given MAT variable to a MAT file. | |
int | Mat_VarWriteData (mat_t *mat, matvar_t *matvar, void *data, int *start, int *stride, int *edge) |
Writes the given data to the MAT variable. | |
int | Mat_VarWriteInfo (mat_t *mat, matvar_t *matvar) |
Writes the given MAT variable to a MAT file. |
enum mat_acc |
enum mat_ft |
enum matio_classes |
Matlab variable classes
enum matio_compression |
enum matio_flags |
enum matio_types |
Matlab data types
int Mat_CalcSingleSubscript | ( | int | rank, | |
int * | dims, | |||
int * | subs | |||
) |
Calculates a single linear subscript (0-relative) given a 1-relative subscript for each dimension. The calculation uses the formula below where index is the linear index, s is an array of length RANK where each element is the subscript for the correspondind dimension, D is an array whose elements are the dimensions of the variable.
rank | Rank of the variable | |
dims | dimensions of the variable | |
subs | Dimension subscripts |
int* Mat_CalcSubscripts | ( | int | rank, | |
int * | dims, | |||
int | index | |||
) |
Calculates 1-relative subscripts for each dimension given a 0-relative linear index. Subscripts are calculated as follows where s is the array of dimension subscripts, D is the array of dimensions, and index is the linear index.
rank | Rank of the variable | |
dims | dimensions of the variable | |
index | linear index |
int Mat_Close | ( | mat_t * | mat | ) |
Closes the given Matlab MAT file and frees any memory with it.
mat | Pointer to the MAT file |
0 |
References mat_t::filename, mat_t::fp, mat_t::header, and mat_t::subsys_offset.
Referenced by Mat_Open(), and Mat_VarDelete().
mat_t* Mat_Create | ( | const char * | matname, | |
const char * | hdr_str | |||
) |
Tries to create a new Matlab MAT file with the given name and optional header string. If no header string is given, the default string is used containing the software, version, and date in it. If a header string is given, at most the first 116 characters is written to the file. The given header string need not be the full 116 characters, but MUST be NULL terminated.
matname | Name of MAT file to create | |
hdr_str | Optional header string, NULL to use default |
References mat_t::bof, mat_t::byteswap, mat_t::filename, mat_t::fp, mat_t::header, MAT_ACC_RDWR, mat_t::mode, mat_t::subsys_offset, and mat_t::version.
Referenced by Mat_Open(), and Mat_VarDelete().
mat_t* Mat_Open | ( | const char * | matname, | |
int | mode | |||
) |
Tries to open a Matlab MAT file with the given name
matname | Name of MAT file to open | |
mode | File access mode (MAT_ACC_RDONLY,MAT_ACC_RDWR,etc). |
References mat_t::bof, mat_t::byteswap, mat_t::filename, mat_t::fp, mat_t::header, MAT_ACC_RDONLY, MAT_ACC_RDWR, Mat_Close(), Mat_Create(), MAT_FT_MAT4, Mat_int16Swap(), mat_t::mode, mat_t::subsys_offset, and mat_t::version.
Referenced by Mat_VarDelete().
int Mat_Rewind | ( | mat_t * | mat | ) |
Rewinds a Matlab MAT file to the first variable
mat | Pointer to the MAT file |
0 | on success |
References mat_t::fp, MAT_FT_MAT4, and mat_t::version.
size_t Mat_SizeOfClass | ( | int | class_type | ) |
Returns the size (in bytes) of the matlab class class_type
class_type | Matlab class type (MAT_C_*) |
References MAT_C_CHAR, MAT_C_DOUBLE, MAT_C_INT16, MAT_C_INT32, MAT_C_INT64, MAT_C_INT8, MAT_C_SINGLE, MAT_C_UINT16, MAT_C_UINT32, MAT_C_UINT64, and MAT_C_UINT8.
Referenced by Mat_VarGetSize().
Adds the given field to the structure. fields should be an array of matvar_t pointers of the same size as the structure (i.e. 1 field per structure element).
matvar | Pointer to the Structure MAT variable | |
fields | Array of fields to be added |
0 | on success |
References matvar_t::data, matvar_t::dims, matvar_t::nbytes, and matvar_t::rank.
matvar_t* Mat_VarCalloc | ( | void | ) |
References matvar_t::class_type, matvar_t::compression, matvar_t::data, matvar_t::data_size, matvar_t::data_type, matvar_t::datapos, matvar_t::dims, matvar_t::fp, matvar_t::fpos, matvar_t::isComplex, matvar_t::isGlobal, matvar_t::isLogical, matvar_t::mem_conserve, matvar_t::name, matvar_t::nbytes, and matvar_t::rank.
Referenced by Mat_VarCreate(), Mat_VarReadNextInfo5(), and ReadNextCell().
matvar_t* Mat_VarCreate | ( | const char * | name, | |
int | class_type, | |||
int | data_type, | |||
int | rank, | |||
int * | dims, | |||
void * | data, | |||
int | opt | |||
) |
Creates a MAT variable that can be written to a Matlab MAT file with the given name, data type, dimensions and data. Rank should always be 2 or more. i.e. Scalar values would have rank=2 and dims[2] = {1,1}. Data type is one of the MAT_T types. MAT adds MAT_T_STRUCT and MAT_T_CELL to create Structures and Cell Arrays respectively. For MAT_T_STRUCT, data should be a NULL terminated array of matvar_t * variables (i.e. for a 3x2 structure with 10 fields, there should be 61 matvar_t * variables where the last one is NULL). For cell arrays, the NULL termination isn't necessary. So to create a cell array of size 3x2, data would be the address of an array of 6 matvar_t * variables.
EXAMPLE: To create a struct of size 3x2 with 3 fields:
int rank=2, dims[2] = {3,2}, nfields = 3; matvar_t **vars; vars = malloc((3*2*nfields+1)*sizeof(matvar_t *)); vars[0] = Mat_VarCreate(...); : vars[3*2*nfields-1] = Mat_VarCreate(...); vars[3*2*nfields] = NULL;
EXAMPLE: To create a cell array of size 3x2:
int rank=2, dims[2] = {3,2}; matvar_t **vars; vars = malloc(3*2*sizeof(matvar_t *)); vars[0] = Mat_VarCreate(...); : vars[5] = Mat_VarCreate(...);
name | Name of the variable to create | |
class_type | class type of the variable in Matlab(one of the mx Classes) | |
data_type | data type of the variable (one of the MAT_T_ Types) | |
rank | Rank of the variable | |
dims | array of dimensions of the variable of size rank | |
data | pointer to the data | |
opt | 0, or bitwise or of the following options:
|
References matvar_t::class_type, matvar_t::compression, COMPRESSION_NONE, matvar_t::data, matvar_t::data_size, matvar_t::data_type, matvar_t::dims, ComplexSplit::Im, matvar_t::isComplex, matvar_t::isGlobal, matvar_t::isLogical, MAT_C_CHAR, MAT_C_SPARSE, MAT_F_COMPLEX, MAT_F_GLOBAL, MAT_F_LOGICAL, MAT_T_CELL, MAT_T_DOUBLE, MAT_T_INT16, MAT_T_INT32, MAT_T_INT64, MAT_T_INT8, MAT_T_SINGLE, MAT_T_STRUCT, MAT_T_UINT16, MAT_T_UINT32, MAT_T_UINT64, MAT_T_UINT8, MAT_T_UTF16, MAT_T_UTF32, MAT_T_UTF8, Mat_VarCalloc(), Mat_VarFree(), matvar_t::mem_conserve, matvar_t::name, matvar_t::nbytes, matvar_t::rank, and ComplexSplit::Re.
int Mat_VarDelete | ( | mat_t * | mat, | |
char * | name | |||
) |
mat | Pointer to the mat_t file structure | |
name | Name of the variable to delete |
References mat_t::filename, mat_t::fp, mat_t::header, Mat_Close(), Mat_Create(), Mat_Open(), Mat_VarFree(), Mat_VarReadNext(), Mat_VarWrite(), mat_t::mode, and matvar_t::name.
Provides a clean function for duplicating a matvar_t structure.
in | pointer to the matvar_t structure to be duplicated | |
opt | 0 does a shallow duplicate and only assigns the data pointer to the duplicated array. 1 will do a deep duplicate and actually duplicate the contents of the data. Warning: If you do a shallow copy and free both structures, the data will be freed twice and memory will be corrupted. This may be fixed in a later release. |
References matvar_t::class_type, matvar_t::compression, matvar_t::data, matvar_t::data_size, matvar_t::data_type, matvar_t::datapos, matvar_t::dims, matvar_t::fpos, ComplexSplit::Im, matvar_t::isComplex, matvar_t::isGlobal, matvar_t::isLogical, MAT_C_CELL, MAT_C_STRUCT, Mat_VarDuplicate(), matvar_t::mem_conserve, matvar_t::name, matvar_t::nbytes, matvar_t::rank, and ComplexSplit::Re.
Referenced by Mat_VarDuplicate(), Mat_VarGetStructs(), and Mat_VarGetStructsLinear().
void Mat_VarFree | ( | matvar_t * | matvar | ) |
Frees memory used by a MAT variable. Frees the data associated with a MAT variable if it's non-NULL and MEM_CONSERVE was not used.
matvar | Pointer to the matvar_t structure |
References matvar_t::class_type, matvar_t::compression, COMPRESSION_ZLIB, sparse_t::data, matvar_t::data, matvar_t::data_size, matvar_t::dims, ComplexSplit::Im, sparse_t::ir, matvar_t::isComplex, sparse_t::jc, MAT_C_CELL, MAT_C_SPARSE, MAT_C_STRUCT, Mat_VarFree(), matvar_t::mem_conserve, matvar_t::name, matvar_t::nbytes, and ComplexSplit::Re.
Referenced by Mat_VarCreate(), Mat_VarDelete(), Mat_VarFree(), Mat_VarGetStructs(), Mat_VarReadInfo(), Mat_VarReadNextInfo5(), ReadNextCell(), and ReadNextStructField().
Returns a pointer to the Cell Array Field at the given 1-relative index. MAT file must be a version 5 matlab file.
matvar | Pointer to the Cell Array MAT variable | |
index | linear index of cell to return |
References matvar_t::data, matvar_t::dims, and matvar_t::rank.
Finds cells of a cell array given a start, stride, and edge for each. dimension. The cells are placed in a pointer array. The cells should not be freed, but the array of pointers should be. If copies are needed, use Mat_VarDuplicate on each cell. MAT File version must be 5.
matvar | Cell Array matlab variable | |
start | vector of length rank with 0-relative starting coordinates for each diemnsion. | |
stride | vector of length rank with strides for each diemnsion. | |
edge | vector of length rank with the number of elements to read in each diemnsion. |
References matvar_t::data, matvar_t::dims, and matvar_t::rank.
Finds cells of a cell array given a linear indexed start, stride, and edge. The cells are placed in a pointer array. The cells themself should not be freed as they are part of the original cell array, but the pointer array should be. If copies are needed, use Mat_VarDuplicate on each of the cells. MAT file version must be 5.
matvar | Cell Array matlab variable | |
start | starting index | |
stride | stride | |
edge | Number of cells to get |
References matvar_t::data, and matvar_t::rank.
int Mat_VarGetNumberOfFields | ( | matvar_t * | matvar | ) |
Returns the number of fields in the given structure. MAT file version must be 5.
matvar | Structure matlab variable |
References matvar_t::class_type, matvar_t::data_size, matvar_t::dims, MAT_C_STRUCT, matvar_t::nbytes, and matvar_t::rank.
size_t Mat_VarGetSize | ( | matvar_t * | matvar | ) |
matvar | matlab variable |
References matvar_t::class_type, matvar_t::data, matvar_t::data_size, matvar_t::dims, MAT_C_CELL, MAT_C_STRUCT, Mat_SizeOfClass(), Mat_VarGetSize(), matvar_t::nbytes, and matvar_t::rank.
Referenced by Mat_VarGetSize().
Returns a pointer to the structure field at the given 0-relative index. MAT file version must be 5.
matvar | Pointer to the Structure MAT variable | |
name_or_index | Name of the field, or the 1-relative index of the field. If the index is used, it should be the address of an integer variable whose value is the index number. | |
opt | BY_NAME if the name_or_index is the name or BY_INDEX if the index was passed. | |
index | linear index of the structure to find the field of |
References BY_INDEX, BY_NAME, matvar_t::data, matvar_t::dims, matvar_t::name, matvar_t::nbytes, and matvar_t::rank.
matvar_t* Mat_VarGetStructs | ( | matvar_t * | matvar, | |
int * | start, | |||
int * | stride, | |||
int * | edge, | |||
int | copy_fields | |||
) |
Finds structures of a structure array given a start, stride, and edge for each dimension. The structures are placed in a new structure array. If copy_fields is non-zero, the indexed structures are copied and should be freed, but if copy_fields is zero, the indexed structures are pointers to the original, but should still be freed since the mem_conserve flag is set so that the structures are not freed. MAT File version must be 5.
matvar | Structure matlab variable | |
start | vector of length rank with 0-relative starting coordinates for each diemnsion. | |
stride | vector of length rank with strides for each diemnsion. | |
edge | vector of length rank with the number of elements to read in each diemnsion. | |
copy_fields | 1 to copy the fields, 0 to just set pointers to them. If 0 is used, the fields should not be freed themselves. |
References matvar_t::class_type, matvar_t::data, matvar_t::data_size, matvar_t::dims, MAT_C_STRUCT, Mat_VarDuplicate(), Mat_VarFree(), matvar_t::mem_conserve, matvar_t::nbytes, and matvar_t::rank.
matvar_t* Mat_VarGetStructsLinear | ( | matvar_t * | matvar, | |
int | start, | |||
int | stride, | |||
int | edge, | |||
int | copy_fields | |||
) |
Finds structures of a structure array given a single (linear)start, stride, and edge. The structures are placed in a new structure array. If copy_fields is non-zero, the indexed structures are copied and should be freed, but if copy_fields is zero, the indexed structures are pointers to the original, but should still be freed since the mem_conserve flag is set so that the structures are not freed. MAT File version must be 5.
matvar | Structure matlab variable | |
start | starting index | |
stride | stride | |
edge | Number of structures to get | |
copy_fields | 1 to copy the fields, 0 to just set pointers to them. If 0 is used, the fields should not be freed themselves. |
References matvar_t::data, matvar_t::data_size, matvar_t::dims, Mat_VarDuplicate(), matvar_t::mem_conserve, matvar_t::nbytes, and matvar_t::rank.
void Mat_VarPrint | ( | matvar_t * | matvar, | |
int | printdata | |||
) |
Prints to stdout the values of the matvar_t structure
matvar | Pointer to the matvar_t structure | |
printdata | set to 1 if the Variables data should be printed, else 0 |
References matvar_t::fp, MAT_FT_MAT4, Mat_VarPrint5(), and mat_t::version.
Referenced by Mat_VarPrint5().
Reads the next variable in the Matlab MAT file
mat | Pointer to the MAT file | |
name | Name of the variable to read |
References mat_t::fp, and Mat_VarReadInfo().
int Mat_VarReadData | ( | mat_t * | mat, | |
matvar_t * | matvar, | |||
void * | data, | |||
int * | start, | |||
int * | stride, | |||
int * | edge | |||
) |
Reads data from a MAT variable. The variable must have been read by Mat_VarReadInfo.
mat | MAT file to read data from | |
matvar | MAT variable information | |
data | pointer to store data in (must be pre-allocated) | |
start | array of starting indeces | |
stride | stride of data | |
edge | array specifying the number to read in each direction |
0 | on success |
References MAT_FT_MAT4, ReadData5(), and mat_t::version.
Allocates memory for an reads the data for a given matlab variable.
mat | Matlab MAT file structure pointer | |
matvar | Variable whose data is to be read |
int Mat_VarReadDataLinear | ( | mat_t * | mat, | |
matvar_t * | matvar, | |||
void * | data, | |||
int | start, | |||
int | stride, | |||
int | edge | |||
) |
Reads data from a MAT variable using a linear indexingmode. The variable must have been read by Mat_VarReadInfo.
mat | MAT file to read data from | |
matvar | MAT variable information | |
data | pointer to store data in (must be pre-allocated) | |
start | starting index | |
stride | stride of data | |
edge | number of elements to read |
0 | on success |
References mat_t::byteswap, matvar_t::class_type, matvar_t::compression, COMPRESSION_NONE, COMPRESSION_ZLIB, matvar_t::data_size, matvar_t::data_type, matvar_t::datapos, matvar_t::dims, mat_t::fp, InflateDataType(), InflateSkip(), InflateSkipData(), MAT_C_DOUBLE, MAT_C_INT16, MAT_C_INT32, MAT_C_INT64, MAT_C_INT8, MAT_C_SINGLE, MAT_C_UINT16, MAT_C_UINT32, MAT_C_UINT64, MAT_C_UINT8, MAT_FT_MAT4, Mat_int32Swap(), MAT_T_DOUBLE, MAT_T_INT16, MAT_T_INT32, MAT_T_INT64, MAT_T_INT8, MAT_T_SINGLE, MAT_T_UINT16, MAT_T_UINT32, MAT_T_UINT64, MAT_T_UINT8, matvar_t::rank, ReadCompressedDoubleData(), ReadCompressedInt16Data(), ReadCompressedInt32Data(), ReadCompressedInt64Data(), ReadCompressedInt8Data(), ReadCompressedSingleData(), ReadDoubleData(), ReadInt16Data(), ReadInt32Data(), ReadInt64Data(), ReadInt8Data(), ReadSingleData(), and mat_t::version.
Reads the named variable (or the next variable if name is NULL) information (class,flags-complex/global/logical,rank,dimensions,and name) from the Matlab MAT file
mat | Pointer to the MAT file | |
name | Name of the variable to read |
References mat_t::bof, mat_t::byteswap, mat_t::fp, Mat_int32Swap(), Mat_VarFree(), Mat_VarReadNextInfo(), and matvar_t::name.
Referenced by Mat_VarRead().
Reads the next variable in the Matlab MAT file
mat | Pointer to the MAT file |
References mat_t::fp, and Mat_VarReadNextInfo().
Referenced by Mat_VarDelete().
Reads the next variable's information (class,flags-complex/global/logical, rank,dimensions, name, etc) from the Matlab MAT file. After reading, the MAT file is positioned past the current variable.
mat | Pointer to the MAT file |
References Mat_VarReadNextInfo5(), and mat_t::version.
Referenced by Mat_VarReadInfo(), Mat_VarReadNext(), and ReadNextFunctionHandle().
Writes the MAT variable information stored in matvar to the given MAT file. The variable will be written to the end of the file.
mat | MAT file to write to | |
matvar | MAT variable information to write | |
compress | Whether or not to compress the data (Only valid for version 5 MAT files and variables with numeric data) |
0 | on success |
References MAT_FT_MAT4, mat_t::version, and Write5().
Referenced by Mat_VarDelete().
int Mat_VarWriteData | ( | mat_t * | mat, | |
matvar_t * | matvar, | |||
void * | data, | |||
int * | start, | |||
int * | stride, | |||
int * | edge | |||
) |
Writes data to a MAT variable. The variable must have previously been written with Mat_VarWriteInfo.
mat | MAT file to write to | |
matvar | MAT variable information to write | |
data | pointer to the data to write | |
start | array of starting indeces | |
stride | stride of data | |
edge | array specifying the number to read in each direction |
0 | on success |
References matvar_t::class_type, matvar_t::compression, COMPRESSION_NONE, COMPRESSION_ZLIB, matvar_t::data_type, matvar_t::datapos, matvar_t::dims, mat_t::fp, MAT_C_CHAR, MAT_C_DOUBLE, MAT_C_INT16, MAT_C_INT32, MAT_C_INT64, MAT_C_INT8, MAT_C_SINGLE, MAT_C_UINT16, MAT_C_UINT32, MAT_C_UINT64, MAT_C_UINT8, matvar_t::rank, WriteCharDataSlab2(), WriteData(), and WriteDataSlab2().
Writes the MAT variable information stored in matvar to the given MAT file. The variable will be written to the end of the file.
mat | MAT file to write to | |
matvar | MAT variable information to write |
0 | on success |
References mat_t::fp, MAT_FT_MAT4, mat_t::version, and WriteInfo5().