12 if (inputVariableType == VariableType::Element ||
13 inputVariableType == VariableType::Vector ||
14 inputVariableType == VariableType::MultiDimensionalArray)
16 switch (inputValueType)
19 outputMatioClasses = matio_classes::MAT_C_INT8;
20 outputMatioType = matio_types::MAT_T_INT8;
24 outputMatioClasses = matio_classes::MAT_C_UINT8;
25 outputMatioType = matio_types::MAT_T_UINT8;
28 outputMatioClasses = matio_classes::MAT_C_INT16;
29 outputMatioType = matio_types::MAT_T_INT16;
32 outputMatioClasses = matio_classes::MAT_C_UINT16;
33 outputMatioType = matio_types::MAT_T_UINT16;
36 outputMatioClasses = matio_classes::MAT_C_INT32;
37 outputMatioType = matio_types::MAT_T_INT32;
40 outputMatioClasses = matio_classes::MAT_C_UINT32;
41 outputMatioType = matio_types::MAT_T_UINT32;
44 outputMatioClasses = matio_classes::MAT_C_SINGLE;
45 outputMatioType = matio_types::MAT_T_SINGLE;
48 outputMatioClasses = matio_classes::MAT_C_DOUBLE;
49 outputMatioType = matio_types::MAT_T_DOUBLE;
52 outputMatioClasses = matio_classes::MAT_C_INT64;
53 outputMatioType = matio_types::MAT_T_INT64;
56 outputMatioClasses = matio_classes::MAT_C_UINT64;
57 outputMatioType = matio_types::MAT_T_UINT64;
60 outputMatioClasses = matio_classes::MAT_C_CHAR;
61 outputMatioType = matio_types::MAT_T_UTF8;
64 outputMatioClasses = matio_classes::MAT_C_CHAR;
65 outputMatioType = matio_types::MAT_T_UTF16;
68 outputMatioClasses = matio_classes::MAT_C_CHAR;
69 outputMatioType = matio_types::MAT_T_UTF32;
72 outputMatioClasses = matio_classes::MAT_C_CHAR;
73 outputMatioType = matio_types::MAT_T_STRING;
79 else if (inputVariableType == VariableType::Struct || inputVariableType == VariableType::StructArray)
81 outputMatioClasses = matio_classes::MAT_C_STRUCT;
82 outputMatioType = matio_types::MAT_T_STRUCT;
84 else if (inputVariableType == VariableType::CellArray)
86 outputMatioClasses = matio_classes::MAT_C_CELL;
87 outputMatioType = MAT_T_CELL;
104 switch (input->data_type)
106 case matio_types::MAT_T_INT8:
109 case matio_types::MAT_T_UINT8:
112 case matio_types::MAT_T_INT16:
115 case matio_types::MAT_T_UINT16:
118 case matio_types::MAT_T_INT32:
121 case matio_types::MAT_T_UINT32:
124 case matio_types::MAT_T_SINGLE:
127 case matio_types::MAT_T_DOUBLE:
130 case matio_types::MAT_T_INT64:
133 case matio_types::MAT_T_UINT64:
136 case matio_types::MAT_T_UTF8:
139 case matio_types::MAT_T_UTF16:
142 case matio_types::MAT_T_UTF32:
145 case matio_types::MAT_T_STRING:
148 case matio_types::MAT_T_CELL:
149 case matio_types::MAT_T_STRUCT:
150 case matio_types::MAT_T_ARRAY:
151 case matio_types::MAT_T_MATRIX:
154 case matio_types::MAT_T_COMPRESSED:
155 case matio_types::MAT_T_FUNCTION:
156 case matio_types::MAT_T_UNKNOWN:
161 if (input->isLogical)
169 if ((input->class_type == matio_classes::MAT_C_OBJECT) ||
170 (input->class_type == matio_classes::MAT_C_SPARSE) ||
171 (input->class_type == matio_classes::MAT_C_FUNCTION) ||
172 (input->class_type == matio_classes::MAT_C_OPAQUE) ||
180 size_t dimensionsProduct = 1;
181 for (
int i = 0; i < input->rank; ++i)
183 dimensionsProduct *= input->dims[i];
186 if (input->class_type == matio_classes::MAT_C_CELL || input->data_type == matio_types::MAT_T_CELL)
190 else if (dimensionsProduct == 1)
192 if (input->data_type == matio_types::MAT_T_STRUCT)
196 else if ((input->data_type == MAT_T_ARRAY) || (input->data_type == MAT_T_MATRIX))
207 if (input->data_type == matio_types::MAT_T_STRUCT)
211 else if ((input->data_type == MAT_T_ARRAY) || (input->data_type == MAT_T_MATRIX))
215 else if ((input->rank == 2) && ((input->dims[0] == 1) || (input->dims[1] == 1)))
235 switch (input->data_type)
237 case matio_types::MAT_T_INT8:
240 case matio_types::MAT_T_UINT8:
243 case matio_types::MAT_T_INT16:
246 case matio_types::MAT_T_UINT16:
249 case matio_types::MAT_T_INT32:
252 case matio_types::MAT_T_UINT32:
255 case matio_types::MAT_T_SINGLE:
258 case matio_types::MAT_T_DOUBLE:
261 case matio_types::MAT_T_INT64:
264 case matio_types::MAT_T_UINT64:
267 case matio_types::MAT_T_UTF8:
270 case matio_types::MAT_T_UTF16:
273 case matio_types::MAT_T_UTF32:
276 case matio_types::MAT_T_STRING:
279 case matio_types::MAT_T_CELL:
282 case matio_types::MAT_T_STRUCT:
285 case matio_types::MAT_T_ARRAY:
288 case matio_types::MAT_T_MATRIX:
291 case matio_types::MAT_T_COMPRESSED:
292 dataType =
"COMPRESSED";
294 case matio_types::MAT_T_FUNCTION:
295 dataType =
"FUNCTION";
297 case matio_types::MAT_T_UNKNOWN:
298 dataType =
"UNKNOWN";
302 if (input->isLogical)
304 dataType = dataType +
" (Logical)";
307 switch (input->class_type)
316 classType =
"STRUCT";
319 classType =
"OBJECT";
325 classType =
"SPARSE";
328 classType =
"DOUBLE";
331 classType =
"SINGLE";
343 classType =
"UINT16";
349 classType =
"UINT32";
355 classType =
"UINT64";
358 classType =
"FUNCTION";
361 classType =
"OPAQUE";
bool get_matio_types(const VariableType &inputVariableType, const ValueType &inputValueType, matio_classes &outputMatioClasses, matio_types &outputMatioType)
Get both the matio type and class from the input VariableType and ValueType.
VariableType
Define the type of variable.
bool get_types_from_matvart(const matvar_t *input, VariableType &outputVariableType, ValueType &outputValueType)
Get the VariableType and the ValueType from a matvar_t pointer.
ValueType
The list of types for an element of a certain variable type.
bool get_types_names_from_matvart(const matvar_t *input, std::string &classType, std::string &dataType)
Get the type names from the input pointer.