matlab c++ data arrays to c++
이전 댓글 표시
how i can transfer arrays that i save from matlab to call it and use it in c++ code
댓글 수: 3
Jan
2022년 2월 13일
It depends on what arrays you mean. DOUBLE arrays can be saved in binary files easily. If you are talking of struct arrays, which fields contain handles of graphic objects, the problem is serious.
MOHAMMED ALMANSOUR
2022년 2월 13일
Jan
2022년 2월 13일
You can either write a Mex function to call the C++ routine directly without the indirection over the hard disk. Or you can save the data to a binary file using fopen/fwrite/fclose.
답변 (1개)
Akshat Dalal
2025년 5월 12일
0 개 추천
Hi Mohammed,
There are a few different ways to achieve this as Jan mentioned. I would also suggest a few other ways:
- Using MATLAB Engine APIs to interface with C++ code: https://www.mathworks.com/help/matlab/matlab_external/pass-variables-from-matlab-to-c.html
- Using coder.ceval to call C++ code and passing arguments via coder.rref: https://www.mathworks.com/help/simulink/slref/coder.rref.html
I hope this helps!
카테고리
도움말 센터 및 File Exchange에서 MATLAB Coder에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!