0

I have a 2-D double-precision array in MATLAB that contains specific data. I want to use this array in c++, so I save the array in a mat-file. I know that MATLAB has some c functions that provide reading mat-file in c++ (matdsgn , matOpen , ...), but I don't know how to use them in a c++ program. Actually, I don't know how to use a C library in C++. Any help would be appreciated.

  • 2
    Possible duplicate of [Efficient way of converting matlab matrix to array in c++](https://stackoverflow.com/questions/17591158/efficient-way-of-converting-matlab-matrix-to-array-in-c) – Andre Kampling Aug 28 '17 at 11:13
  • I'd recommend thinking about whether what you really want to do is create a MAT file on disk and then work with this MAT file in your standalone C++ program, or whether what you would prefer to do is simply pass the MATLAB array to C++ code. If it's the latter, you should look at the MEX interface provided by MATLAB for this purpose: https://www.mathworks.com/help/matlab/matlab_external/introducing-mex-files.html – Alex Taylor Aug 28 '17 at 15:00

1 Answers1

0

If you have MATLAB 2017a, there is a built-in function. See this MATHWORKS link: Math Works

XRR
  • 418
  • 4
  • 16