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.
-
2Possible duplicate of Efficient way of converting matlab matrix to array in c++Andre Kampling– Andre Kampling2017-08-28 11:13:59 +00:00Commented Aug 28, 2017 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: mathworks.com/help/matlab/matlab_external/…Alex Taylor– Alex Taylor2017-08-28 15:00:19 +00:00Commented Aug 28, 2017 at 15:00
Add a comment
|
1 Answer
If you have MATLAB 2017a, there is a built-in function. See this MATHWORKS link: Math Works