Convert MATLAB program to C++

23 views (last 30 days)
Yudong on 17 Jun 2013
Commented: 632541 on 12 Apr 2021
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 Comment
Kaustubha Govind
Kaustubha Govind on 17 Jun 2013
Edited: Kaustubha Govind on 17 Jun 2013
It looks like you may not have configured your project correctly. Please try using the mbuild command as described in href = ">">this example</a first to see if you are able to compile your driver application.

Sign in to comment.

Accepted Answer

Lokesh Ravindranathan
Lokesh Ravindranathan on 17 Jun 2013
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 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.
632541 on 12 Apr 2021
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.

Sign in to comment.

More Answers (0)


Find more on MATLAB Coder in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!