필터 지우기
필터 지우기

Can we generate c code for a matlab file which calls a mex source file

조회 수: 1 (최근 30일)
RAJESH TANKASALA
RAJESH TANKASALA 2011년 5월 21일
As we know that from matlab we can call c code using mex functions. If we have a matlab file in which I replace a matlab function with my mex source file and integrate it with the existing matlab file, can we generate the c code for this? I tried with emlc "mfile.m" but getting this error " Embedded MATLAB can only compile MATLAB files; unsupported file extension 'mexw32' for whatever mexfile we replaced.
If I am success to generate the c code for mfile, then most of my issues will be resolved. If possible pls send the answer to the follwoing mail id.

답변 (1개)

John Elliott
John Elliott 2011년 5월 21일
The emlc command cannot compile mex functions. You have two options for integrating your mex function algorithm with the MATLAB file using emlc. 1) If you have the original C code for the mex function, then you can combine the original C code with the MATLAB code using emlc, and call the C code using the ceval function. Refer to the documentation for eml.ceval and custom code integration using emlc. With this approach, you can integrate your mex function algorithm with the compiled MATLAB file for both mex and standalone targets. 2) If you do not have the original C code for the mex function, you can use eml.extrinsic to declare that the mex function should be called using mexCallMATLAB. This will not 'compile' the mex function, but it will make it accessible from the code generated by emlc. Note that this only works if you are using emlc to generate a mex function; it will not work if you are generating standalone C code. Refer to the documentation for eml.extrinsic.

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by