Mat_CreateVer (3) - Linux Man Pages

Mat_CreateVer: Create a MATLAB .mat file


Mat_CreateVer Mat_Create - Create a MATLAB .mat file


Fd #include <matio.h> Ft mat_t * Fo Mat_CreateVer Fa const char *matname Fa const char *hdr_str Fa enum mat_ft mat_file_ver Fc Ft mat_t * Fo Mat_Create Fa const char *matname Fa const char *hdr_str Fc


The Fn Mat_CreateVer function creates a MATLAB .mat file opened for write access. The hdr_str is a string written in the file header of MAT version 5 and 7.3 (HDF) files. Only the first 128 bytes of the string is written. If hdr_str is NULL, then a default string is written that contains the platform, date, matio library version.

The mat_file_ver argument specifies the MAT file version to create. The matio library can write version 5 files (MAT_FT_MAT5), and an HDF5 file format introduced in MATLAB version 7.3 (MAT_FT_MAT73).

The Fn Mat_Create function is equivalent to calling Fn Mat_CreateVer with MAT_FT_DEFAULT as the file version.


#include <stdlib.h>
#include <stdio.h>
#include "matio.h"

int main(int argc,char **argv)
    mat_t *matfp;

    matfp = Mat_CreateVer(argv[1],NULL,MAT_FT_73);
    if ( NULL == matfp ) {
        fprintf(stderr,"Error creating MAT file %s,argv[1]);
        return EXIT_FAILURE;

    return EXIT_SUCCESS;


Mat_Create3, Mat_CreateVer3, Mat_Close3