Debian Codegraph @

matio-1.5.30/documentation/matvar_structure.texi

raw
1 @c Copyright (c) 2015-2026, The matio contributors
2 @c Copyright (c) 2011-2014, Christopher C. Hulbert
3 @c All rights reserved.
4 @c
5 @c Redistribution and use in source and binary forms, with or without
6 @c modification, are permitted provided that the following conditions are met:
7 @c
8 @c 1. Redistributions of source code must retain the above copyright notice, this
9 @c list of conditions and the following disclaimer.
10 @c
11 @c 2. Redistributions in binary form must reproduce the above copyright notice,
12 @c this list of conditions and the following disclaimer in the documentation
13 @c and/or other materials provided with the distribution.
14 @c
15 @c THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 @c AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 @c IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 @c DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
19 @c FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 @c DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21 @c SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22 @c CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23 @c OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 @c OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
26 @chapter MATLAB Variable Structure
27 @section Variable Information
28 When a MATLAB variable is read or created, all of the information about the
29 variable (e.g. name, dimensions, etc.) are stored in the MATLAB variable
30 structure type @code{matvar_t}.
31 @table @code
32 @item name
33 Nul-terminated string that is the name of the variable. The name may be NULL (e.g. for elements of a cell-array), so the field should be checked prior to use.
34 @item rank
35 The number of dimensions of the variable. The minimum rank is 2.
36 @item dims
37 An array of the number of elements in each dimensions of the variable.
38 @item class_type
39 Indicates the class of the variable (e.g. double-precision, structure, cell,
40 etc.).
41 @item data_type
42 Indicates the type of the data stored in the @code{data} field of the MATLAB
43 variable structure.
44 @item isComplex
45 is non-zero if the variable is a complex-valued numeric array.
46 @item isLogical
47 is non-zero of the variable should be interpreted as logical (i.e. zero for
48 false, non-zero for true).
49 @item isGlobal
50 is non-zero if the variable should be a global variable. In MATLAB a global
51 variable is available in all scopes (e.g. base workspace, function, etc.)
52 @end table
53
54 @subsection Sparse Matrix Variables
55 If a variable's class type is sparse, the @code{data} field of the MATLAB
56 variable structure is a pointer to the sparse matrix structure
57 @code{mat_sparse_t}. The sparse matrix structure stores the non-zero elements of
58 the matrix in compressed column format.
59
60 @subsection Structure Variables
61 @allowcodebreaks false
62 If the MATLAB variable structure's @code{class_type} is @code{MAT_C_STRUCT}, the
63 @code{data_type} field should be @code{MAT_T_STRUCT}. The @code{data} field of
64 the variable structure is a pointer to an array of @code{matvar_t@tie{}*}. The
65 length of the array is @math{numel \times nfields} where @code{numel} is the
66 number of elements in the structure array (product of dimensions array), and
67 @math{nfields} is the number of fields in the structure. The order of the
68 variables in the array is first by field, and then by structure index. For
69 example, for a @math{2 \times 1} structure array with 3 fields @emph{field1},
70 @emph{field2}, and @emph{field3}, @code{data} field of the structure variable
71 is ordered as:
72
73 @table @code
74 @item s(1).field1
75 @item s(1).field2
76 @item s(1).field3
77 @item s(2).field1
78 @item s(2).field2
79 @item s(2).field3
80 @end table
81
82 @node Cell Variables
83 @subsection Cell Variables
84 @allowcodebreaks false
85 If the MATLAB variable structure's @code{class_type} is @code{MAT_C_CELL}, the
86 @code{data_type} field should be @code{MAT_T_CELL}. The @code{data} field of
87 the variable structure is a pointer to an array of @code{matvar_t@tie{}*}. The
88 length of the array is the product of the dimensions array. Each element of the
89 cell array can be a different type.