Convert MATLAB program to C++

조회 수: 23 (최근 30일)
Yudong
Yudong 2013년 6월 17일
댓글: 632541 2021년 4월 12일
My current task is to convert a MATLAB program to C++, which contains image processing functions like imread, edge, strel, etc. Since it took a long time to finish the MATLAB program, so we want to take a shortcut instead of translating it in C++. I've tried MATLAB Coder, but it can't convert those MATLAB functions. So I tried another tool: MATLAB Compiler. Unfortunately, some errors block me going further. I posted a question here:
However, the problem hasn't been resolved yet. I'm appreciated it if you can answer my question in stackoverflow or here, but I'm more eager to know whether it is an efficient way to convert my MATLAB program to C++ by using MATLAB Compiler like what I've done? Are there any better ways to finish my task? Please give me any guide or advice to help.
  댓글 수: 1
Kaustubha Govind
Kaustubha Govind 2013년 6월 17일
편집: Kaustubha Govind 2013년 6월 17일
It looks like you may not have configured your project correctly. Please try using the mbuild command as described in href = ">http://www.mathworks.com/help/compiler/c-shared-library-target.html#f2-1000836">this example</a first to see if you are able to compile your driver application.

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

채택된 답변

Lokesh Ravindranathan
Lokesh Ravindranathan 2013년 6월 17일
Hi Yudong,
We currently do not support code generation for the image processing functions such as imread, edge, strel, etc and you are right about this. Functions http://www.mathworks.com/help/simulink/ug/functions-supported-for-code-generation--alphabetical-list.html are supported for code generation. You need the MATLAB Coder product. To support your workflow, I would suggest using the supported functions, generate code and qualify performance.
MATLAB Compiler might not be the right product for converting into C++ code. Its just a thin wrapper around the MEX files for easy deployment.
  댓글 수: 3
Steven Lord
Steven Lord 2020년 10월 22일
To determine if a function supports C/C++ code generation (and what limitations that function has if any when used in code generation) look at the documentation page. If it has a section titled "Extended Capabilities" see if that section has an item titled "C/C++ Code Generation". If it doesn't have an Extended Capabilities section or if that section doesn't have a C/C++ Code Generation item it is not supported for code generation.
The sde documentation page does not have an Extended Capabilities section so it is not supported in code generation. Compare that with the documentation page for the sum function which does support C/C++ code generation with a few caveats.
More generally you can filter the function list by product and by the different items under Extended Capabilities to see the list of functions supported for code generation.
632541
632541 2021년 4월 12일
Hi ,
I am designing digital filter, in my code i am using zp2sos . I want convert matlab code to c .
But getting error for zp2sos.
How can i solve this? Any other methods to convert matlab to C?
I have tried matlab coder.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB Coder에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by