How to Create Basic MEX-functions in CMEX Files?
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I want a basic example on how to create a C Mex File in MATLAB.
Réponse acceptée
MathWorks Support Team
le 30 Juin 2009
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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Write C Functions Callable from MATLAB (MEX Files) dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!