MAT_CREATEVER(3)

πŸ’– NAME πŸ’–

Mat_CreateVer, Mat_Create β€” bestie, this is the one that creates a MATLAB MAT file. New file, fresh start, main character origin story. ✨


🌸 SYNOPSIS 🌸

#include <matio.h>

mat_t *
Mat_CreateVer(const char *matname, const char *hdr_str,
    enum mat_ft mat_file_ver);

mat_t *
Mat_Create(const char *matname, const char *hdr_str);

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so. Mat_CreateVer() makes a MATLAB MAT file and opens it up for write access. Periodt. πŸ’…

The hdr_str is a string that gets written into the file header of MAT version 5 and 7.3 (HDF) files. Heads up though β€” only the first 128 bytes of that string actually make it in, so don't write a novel in there, bestie. πŸ™ˆ If hdr_str is NULL, a default string gets written instead, and that default one contains the platform, the date, and the matio library version. Cute little auto-signature, love that for it.

Now, the mat_file_ver argument is the one telling everybody which MAT file version you're creating. And the matio library can write:

  • version 4 files β€” that's MAT_FT_MAT4
  • version 5 files β€” that's MAT_FT_MAT5
  • and an HDF5 file format that was introduced in MATLAB version 7.3 β€” that's MAT_FT_MAT73

And then there's Mat_Create() β€” it's literally just Mat_CreateVer() but with MAT_FT_DEFAULT as the file version. Same energy, fewer arguments. 🫢


⭐ EXAMPLES ⭐

#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 %s0, argv[1]);
        return EXIT_FAILURE;
    }

    Mat_Close(matfp);
    return EXIT_SUCCESS;
}

πŸ‘‘ SEE ALSO πŸ‘‘


okay that's the whole page, you ate that πŸŽ€ This one's from the Debian crew, dated September 12, 2019, and it's page MAT_CREATEVER(3) of the Library Functions Manual. Now go forth and create some files, icon. πŸŒˆπŸ’œ

πŸ“¦ where this page comes from