How to Create Basic MEX-functions in CMEX Files?
조회 수: 3 (최근 30일)
이전 댓글 표시
I want a basic example on how to create a C Mex File in MATLAB.
채택된 답변
MathWorks Support Team
2009년 6월 30일
Many people have requested a simple example on how to create a C MEX-file in MATLAB 5.0 and later. In response to this request, the attached C MEX-file, named 'mexample', is provided as an introduction to cmex programming. 'mexample' is a commented program which describes how to use the following MEX-functions:
mexErrMsgTxt
mxCreateDoubleMatrix
mxGetM
mxGetN
mxGetPr
mxIsComplex
mxIsSparse
mxIsChar
In MATLAB, mexample accepts two inputs and returns one output. The inputs are a 2-by-2 array denoted as ARRAY_IN and a 2-by-1 vector denoted as VECTOR_IN. The function calculates the determinant of ARRAY_IN, multiplies each element of VECTOR_IN by the determinant, and returns this as the output, denoted by zVECTOR_OUT. All inputs and outputs to this function are assumed to be real (not complex).
댓글 수: 0
추가 답변 (0개)
참고 항목
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!