creating complex MATLAB struct in C++ without using MATLAB Engine

I am looking for a way to implement a data converter in C++ that writes data into a complex MATLAB struct and stores it in a .mat file.
The struct content is should look like this:
struct1 {
substruct {
array21
array22
}
array11
array12
}
The implementation in MATLAB would for instance look like this:
% creating the substruct
Substruct(1).sec = 11;
Substruct(1).nsec = 386;
Substruct(2).sec = 12;
Substruct(2).nsec = 415;
Substruct(3).sec = 13;
Substruct(3).nsec = 543;
% creating struct1
struct1.substruct = Substruct(:);
struct1.my_double = [3912 4356 5638 6838]';
struct1.my_uint = 123;
Since the converter requires to run on computers which do not have MATLAB installed I want to avoid using the MATLAB Engine. Does anyone know if that is possible at all? Thank you for any advices.

댓글 수: 1

In case, you're not aware, a simpler way to construct your substruct:
substruct = struct('sec', {11; 12; 13}, 'nsec', {386; 415; 543})

댓글을 달려면 로그인하십시오.

 채택된 답변

Lukas  Glueck
Lukas Glueck 2019년 7월 31일

0 개 추천

There is a powerful open source library which enables you to store .mat files without need of having MATLAB installed and without using MATLAB compiler:
Some more examples about how to use the library can be found here:

추가 답변 (1개)

Guillaume
Guillaume 2019년 7월 25일

0 개 추천

The documentation of the mat-file format 5 is publicly available, so you can use that to construct your mat file.
Unfortunately, I'm not aware of the same documentation for the newer 7.x mat file formats but any version of matlab (except extremely old ones) can open version 5.

카테고리

도움말 센터File Exchange에서 Call C++ from MATLAB에 대해 자세히 알아보기

질문:

2019년 7월 25일

답변:

2019년 7월 31일

Community Treasure Hunt

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

Start Hunting!

Translated by