Im trying to convert a program from C++/MEX to just C++ using MATIO and I am wondering if MATIO has an equivalent to mxGetPr(cal)
and mxGetPi(cal)
? I see in the struct typedef struct matvar_t
it has void *data
filed
Here is how to write a complex double into a file:
char* fieldname = "MyComplexDoubleVariable";
double real = 4.2;
double imag = 1.5;
mat_complex_split_t mycomplexdouble = {&real, &imag};
size_t dim[2]={ 1, 1 };
matvar_t *variable = Mat_VarCreate(fieldname, MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dim, &mycomplexdouble, MAT_F_COMPLEX);
Mat_VarWrite(matfp,variable, MAT_COMPRESSION_NONE); //or MAT_COMPRESSION_ZLIB
Mat_VarFree(variable);
So working backwards I would think this would work
mat_complex_split_t cal_complex=cal->data;
but I get this error when compiling
error: conversion from ‘void*’ to non-scalar type ‘mat_complex_split_t’ requested
mat_complex_split_t cal_complex=cal->data;
Any help would be greatly appreciated.