How to Create Basic MEX-functions in CMEX Files?

3 ビュー (過去 30 日間)
MathWorks Support Team
MathWorks Support Team 2009 年 6 月 30 日
I want a basic example on how to create a C Mex File in MATLAB.

採用された回答

MathWorks Support Team
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 件)

カテゴリ

Help Center および File ExchangeWrite C Functions Callable from MATLAB (MEX Files) についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by