Can I automatically convert a function from MATLAB or a toolbox into c++ code?
显示 更早的评论
I did some image processing using matlab. Now I am re-writing my matlab code into to c++.
For some of the parts in my matlab code, I use built in MATLAB functions (from the image processing toolbox)such as bwlabel, regionprops, etc. My question is it possible to convert these functions into c++ code. Perhaps using mcc?
Is there any other technique to do so would be of great great help as I believe wriitng the c++ code of such continuos from scratch is a huge task it self.
1 个评论
Jiro Doke
2011-4-9
Just to make sure we cover all venues, do you actually need C++ code? Or do you need to integrate your MATLAB program into your C++ program? With MATLAB Compiler (mcc), you can create stand alone C++ shared libraries:
http://www.mathworks.com/help/toolbox/compiler/f2-995712.html
采纳的回答
更多回答(3 个)
Walter Roberson
2011-3-31
2 个投票
No, there is no Mathworks-provided way to convert that code to C++ except to make calls back to MATLAB . You will have to write your own copies of the routines.
1 个评论
Arnaud Miege
2011-4-9
Actually, that's not quite true. You can use Embeddec MATLAB, and now MATLAB Coder in R2011a, as long as you restrict yourself to the subset of the MATLAB language that supports code generation, as I pointedout in my answer.
Ernur
2011-3-31
0 个投票
You can look into MEX-files, http://www.mathworks.com/support/tech-notes/1600/1605.html. mexCallMATLAB(...) function in particular... In my opinion, it would be more time efficient than writing those functions yourself, especially if you will not use them on a regular basis.
Ernur
P.S.: If you need to use Simulink and have S-functions involved, you can use the same function to call Matlab.
类别
在 帮助中心 和 File Exchange 中查找有关 Simulink Coder 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!