Closed Masterbaggins closed 6 years ago
#include <iostream>
#include "matio.h"
int main(void)
{
mat_t* matfp = Mat_Open("burgers.mat", MAT_ACC_RDONLY);
matvar_t* usol_var = Mat_VarRead(matfp, "usol");
mat_complex_split_t* usol_data = (mat_complex_split_t*)usol_var->data;
double* Re = (double*)(usol_data->Re);
double* Im = (double*)(usol_data->Im);
std::cout << Re[0] << " + " << Im[0] << "i\n";
std::cout << Re[1] << " + " << Im[1] << "i\n";
Mat_VarFree(usol_var);
Mat_Close(matfp);
return 0;
}
Oh, I see :). Thanks a lot!
Hello,
is it possible to read a complex valued Matrix from some .mat file using your software? I couldn't figure out how this is done.
Considering this .mat file, I want to read the variable usol, which is a 2d complex double array of size 256x101. The code looks like this:
I get correct results for the really first entry of the matrix. But moving forward the usol_var pointer, I get inconsistent results. On the other hand, reading standard double vectors (t,x) from data works fine.