3

I'm trying to convert a piece of MATLAB code into C++ via MATLAB coder. Many of the functions in the MATLAB code like imread, imshow, normcorr2 are not supported by MATLAB coder.

What are some options to deal with this? Would it be possible to rewrite these functions using C++ and insert them via MEX file? Note I have very little experience with MATLAB, so I may be talking out of my rear.

1
  • Did you choose the Matlab Coder for a good reason? Maybe the Compiler SDK is the better choice. Users of the application are required to install the free matlab MCR but you don't have to reimplement anything. Commented Feb 10, 2016 at 14:53

1 Answer 1

1

Your idea to provide C code to the coder is right, but mex does not work. Instead, you have to use coder.ceval.

Another option is coder.extrinsic, if you use it you tell the MATLAB coder not to generate code but rather call the function in MATLAB. If you do this, it obviously requires a MATLAB installation on the target system.

Sign up to request clarification or add additional context in comments.

2 Comments

For coder.ceval , if the c code I'm providing is using a library (I'm trying to call opencv's imread in the c code to replace Matlab's imread), would that work?
Yes. You can specify additional libraries for linking.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.