C++ .MAT file format

5 次查看(过去 30 天)
Nycholas Maia
Nycholas Maia 2020-2-2
I have a C++ application that generates a lot of numerical matrices and vectors using C++ numerical libraries as Eigen and Blaze (and std::vector too)
I would like to store these results in a file that could be opened in MATLAB.
I saw that MATLAB have a C/C++ API that enable developers store numbers/strings in the *.mat file format.
But in this MATLAB API my C++ matrices and vectors should be mxArray pointer.
How can I use this MATLAB API to store my Eigen and Blaze matrices?
  2 个评论
James Tursa
James Tursa 2020-2-3
Can you simply write the matrices out to a binary file and then use fread to get them into MATLAB?
Nycholas Maia
Nycholas Maia 2020-2-4
Hi @James Tursa,
Yes, I can do that, but my application will generate a lot os matrices and vectors as results.
I would like to retrive each one by a "name" or "id"...
Like "rotation_matrix", "time_vector"...etc...
And another thing:
I would like to get a specific matrix in this file without need to load all file data.
The HDF5 file format can do that and MATLAB have support to it, but I would like to know if there is a good and stable C++ API to help me.
Or if there is another file format that I can obtain these 2 features:
  • Get matrix by name or path
  • No need to load all file data to get some matrix

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Call C++ from MATLAB 的更多信息

产品


版本

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by