| 1 |
.\" Copyright (c) 2015-2026, The matio contributors |
| 2 |
.\" Copyright (c) 2011-2014, Christopher C. Hulbert |
| 3 |
.\" All rights reserved. |
| 4 |
.\" |
| 5 |
.\" Redistribution and use in source and binary forms, with or without |
| 6 |
.\" modification, are permitted provided that the following conditions are met: |
| 7 |
.\" |
| 8 |
.\" 1. Redistributions of source code must retain the above copyright notice, this |
| 9 |
.\" list of conditions and the following disclaimer. |
| 10 |
.\" |
| 11 |
.\" 2. Redistributions in binary form must reproduce the above copyright notice, |
| 12 |
.\" this list of conditions and the following disclaimer in the documentation |
| 13 |
.\" and/or other materials provided with the distribution. |
| 14 |
.\" |
| 15 |
.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 16 |
.\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 17 |
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 18 |
.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
| 19 |
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 20 |
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| 21 |
.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| 22 |
.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| 23 |
.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 24 |
.\" OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 25 |
.\" |
| 26 |
.Dd September 12, 2019 |
| 27 |
.Dt MAT_CREATEVER 3 |
| 28 |
.Os |
| 29 |
.Sh NAME |
| 30 |
.Nm Mat_CreateVer , |
| 31 |
.Nm Mat_Create |
| 32 |
.Nd Creates a MATLAB MAT file. |
| 33 |
.Sh SYNOPSIS |
| 34 |
.Fd #include <matio.h> |
| 35 |
.Ft mat_t * |
| 36 |
.Fo Mat_CreateVer |
| 37 |
.Fa "const char *matname" |
| 38 |
.Fa "const char *hdr_str" |
| 39 |
.Fa "enum mat_ft mat_file_ver" |
| 40 |
.Fc |
| 41 |
.Ft mat_t * |
| 42 |
.Fo Mat_Create |
| 43 |
.Fa "const char *matname" |
| 44 |
.Fa "const char *hdr_str" |
| 45 |
.Fc |
| 46 |
.Sh DESCRIPTION |
| 47 |
The |
| 48 |
.Fn Mat_CreateVer |
| 49 |
function creates a MATLAB MAT file opened for write access. |
| 50 |
The |
| 51 |
.Em hdr_str |
| 52 |
is a string written in the file header of MAT version 5 and 7.3 (HDF) files. |
| 53 |
Only the first 128 bytes of the string is written. |
| 54 |
If |
| 55 |
.Em hdr_str |
| 56 |
is NULL, then a default string is written that contains the platform, date, |
| 57 |
matio library version. |
| 58 |
.Pp |
| 59 |
The |
| 60 |
.Em mat_file_ver |
| 61 |
argument specifies the MAT file version to create. |
| 62 |
The matio library can write |
| 63 |
version 4 files (MAT_FT_MAT4), |
| 64 |
version 5 files (MAT_FT_MAT5), and an HDF5 file format introduced in MATLAB |
| 65 |
version 7.3 (MAT_FT_MAT73). |
| 66 |
.Pp |
| 67 |
The |
| 68 |
.Fn Mat_Create |
| 69 |
function is equivalent to calling |
| 70 |
.Fn Mat_CreateVer |
| 71 |
with MAT_FT_DEFAULT as the file version. |
| 72 |
.Sh EXAMPLES |
| 73 |
.Bd -literal |
| 74 |
#include <stdlib.h> |
| 75 |
#include <stdio.h> |
| 76 |
#include "matio.h" |
| 77 |
|
| 78 |
int main(int argc, char **argv) |
| 79 |
{ |
| 80 |
mat_t *matfp; |
| 81 |
|
| 82 |
matfp = Mat_CreateVer(argv[1], NULL, MAT_FT_73); |
| 83 |
if ( NULL == matfp ) { |
| 84 |
fprintf(stderr, "Error creating MAT file %s\n", argv[1]); |
| 85 |
return EXIT_FAILURE; |
| 86 |
} |
| 87 |
|
| 88 |
Mat_Close(matfp); |
| 89 |
return EXIT_SUCCESS; |
| 90 |
} |
| 91 |
|
| 92 |
.Ed |
| 93 |
.Sh SEE ALSO |
| 94 |
.Xr Mat_CreateVer 3 , |
| 95 |
.Xr Mat_Close 3 |