Calling a C function from a .m file
조회 수: 1 (최근 30일)
이전 댓글 표시
I'm trying to make a Matlab function that will call a C function and send and receive data from that C function. Basically I'm looking for the equivalent of MexCallMATLAB to write in a .m file.
All help is appreciated.
댓글 수: 0
답변 (2개)
Rick Rosson
2011년 6월 24일
If you own MATLAB Coder (R2011a) or Real-Time Workshop (R2010b or earlier), you can use coder.ceval (MATLAB Coder) or eml.ceval (Real-Time Workshop), and then automatically generate a MEX-Function from the MATLAB code.
댓글 수: 2
Walter Roberson
2011년 6월 24일
Would that be appropriate for the case where someone has an existing C function that they want to call from MATLAB ?
Rick Rosson
2011년 6월 25일
Yes. Please see the following example:
http://www.mathworks.com/matlabcentral/fileexchange/21805
Walter Roberson
2011년 6월 24일
calllib() might be the closest to that. Sometimes, though, it is easier to write an MEX interface to the routine.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Deploy to C++ Applications Using mwArray API (C++03)에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!