Call a mex file and using coder

1 view (last 30 days)
Michael
Michael on 31 Jul 2012
I have some legacy Matlab code which makes a call to a mex file, call it get_score. The mex file was written in C. This Matlab code was then compiled to C using the mcc command. This was all done on an older version of Matlab.
We are now upgrading to the latest version of Matlab so I will be using Matlab Coder to generate C code from our Matlab code. What is the correct way to call the get_score mex file? I tried running mex on the c code and generating a new mexw32 file and calling that but when I attempt to run coder I get the error Unsupported file extension 'mexw32'.
Is the proper way to do this just compile the C code to a standard dll using, say Visual Studio, and then call the dll using coder.ceval?

Accepted Answer

Ryan G
Ryan G on 31 Jul 2012
Edited: Ryan G on 31 Jul 2012
The thing about mex files is they require MATLAB to run (MATLAB executable). MATLAB coder can generate more generic c-code that can be utilized independent of MATLAB so if you try to call a mex-file from this code you may run into issues.
It sounds like you already know what to do and you can use the ceval command directly on the C-code that the mex file utilizes.
  1 Comment
Michael
Michael on 31 Jul 2012
Thanks Ryan, it seemed like that was what I wanted but I'm new to Matlab so just wanted to be sure

Sign in to comment.

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!