1MAT_VARREADINFO(3)       BSD Library Functions Manual       MAT_VARREADINFO(3)
2

NAME

4     Mat_VarReadInfo — Reads the information for a specific variable in a MAT‐
5     LAB MAT file.
6

SYNOPSIS

8     #include <matio.h>
9
10     matvar_t *
11     Mat_VarReadInfo(mat_t *matfp, const char *name);
12

DESCRIPTION

14     The Mat_VarReadInfo() function reads the information for the variable
15     name in the open MAT file.
16

RETURN VALUES

18     If the variable was found in the MAT file and the information about the
19     variable successfully read, a pointer to the MATLAB variable structure is
20     returned.  If the variable was not found, or there was an error reading
21     the variable information, NULL is returned.
22

EXAMPLES

24     #include "matio.h"
25
26     int
27     main(int argc, char **argv)
28     {
29         mat_t    *matfp;
30         matvar_t *matvar;
31
32         matfp = Mat_Open(argv[1], MAT_ACC_RDONLY);
33         if ( NULL == matfp ) {
34             fprintf(stderr, "Error opening MAT file %s0, argv[1]);
35             return EXIT_FAILURE;
36         }
37
38         matvar = Mat_VarReadInfo(matfp, "x");
39         if ( NULL != matvar ) {
40             Mat_VarPrint(matvar);
41             Mat_VarFree(matvar);
42         }
43
44         Mat_Close(matfp);
45         return EXIT_SUCCESS;
46     }
47
48

SEE ALSO

50     Mat_VarRead(3), Mat_VarReadNextInfo(3), Mat_VarPrint(3)
51
52BSD                           September 12, 2019                           BSD
Impressum