MATLAB REAL-TIME WORKSHOP 7 - TARGET LANGUAGE COMPILER Uživatelský manuál Strana 66

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 408
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 65
2 Creating C Language MEX-Files
2-6
For example, if you invoke a MEX-file from the MATLAB workspace with the
command
x = fun(y,z);
the MATLAB interpreter calls mexFunction with the arguments
plhs is a 1-element C array where the single element is a null pointer. prhs is
a 2-element C array where the first element is a pointer to an
mxArray named
Y and the second element is a pointer to an mxArray named Z.
The parameter
plhs points at nothing because the output x is not created until
the subroutine executes. It is the responsibility of the gateway routine to create
an output array and to set a pointer to that array in
plhs[0]. If plhs[0] is left
unassigned, MATLAB prints a warning message stating that no output has
been assigned.
Note It is possible to return an output value even if nlhs = 0. This
corresponds to returning the result in the ans variable.
nlhs = 1
nrhs = 2
plhs
prhs
Ø
Y
Z
Zobrazit stránku 65
1 2 ... 61 62 63 64 65 66 67 68 69 70 71 ... 407 408

Komentáře k této Příručce

Žádné komentáře