MATLAB REAL-TIME WORKSHOP 7 - TARGET LANGUAGE COMPILER Manuel d'utilisateur Page 64

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 408
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 63
2 Creating C Language MEX-Files
2-4
Figure 2-1: C MEX Cycle
const mxArray *A
A = prhs[0]
MATLAB
A call to
MEX-file
func:
[C,D]=func(A,B)
tells MATLAB to
pass variables
A and
B to your MEX-file.
C and D are left
unassigned.
mxArray *C
C = plhs[0]
const mxArray *B
B = prhs[1]
mxArray *D
D = plhs[1]
INPUTS
OUTPUTS
func.c
void mexFunction(
int nlhs, mxArray *plhs[],
int nrhs, const mxArray *prhs[])
In the gateway routine:
Use the
mxCreate functions to create
the MATLAB arrays for your output
arguments. Set
plhs[0], [1], … to the
pointers to the newly created
MATLAB arrays.
Use the
mxGet functions to extract
your data from
prhs[0], [1], …
Call your C subroutine passing the
input and output data pointers as
function parameters.
MATLAB
On return from
MEX-file
func:
[C,D]=func(A,B)
plhs[0]
is assigned
to
C and plhs[1] is
assigned to
D.
Vue de la page 63
1 2 ... 59 60 61 62 63 64 65 66 67 68 69 ... 407 408

Commentaires sur ces manuels

Pas de commentaire