entry point to c/c++ or Fortran MEX file
http://www.mathworks.com/access/helpdesk/help/techdoc/apiref/mexfunction.html
mexFunction (C and Fortran) -
Entry point to C/C++ or Fortran MEX-file
C Syntax
#include "mex.h"
void mexFunction(int nlhs, mxArray *plhs[], int nrhs,
const mxArray *prhs[]);
Fortran
Syntax
subroutine mexFunction(nlhs, plhs, nrhs, prhs)
integer*4 nlhs, nrhs
mwPointer plhs(*), prhs(*)
Arguments
nlhs
Number
of expected output mxArray
s
plhs
Array
of pointers to the expected output mxArray
s
nrhs
Number
of input mxArray
s
prhs
Array of pointers to the
input mxArray
s.
Do not modify any prhs
values in your MEX-file.
Changing the data in these read-only mxArray
s can
produce undesired side effects.
Description
mexFunction
is not a routine you call.
Rather, mexFunction
is the name of the gateway
function in C (subroutine in Fortran) which every MEX-file requires.
When you invoke a MEX-function, MATLAB software finds and loads
the corresponding MEX-file of the same name. MATLAB then searches
for a symbol named mexFunction
within the MEX-file.
If it finds one, it calls the MEX-function using the address of the mexFunction
symbol. MATLAB displays
an error message if it cannot find a routine named mexFunction
inside
the MEX-file.
When you invoke a MEX-file, MATLAB automatically
seeds nlhs
, plhs
, nrhs
,
and prhs
with the caller's information. In the
syntax of the MATLAB language, functions have the general form:
[a,b,c,...] = fun(d,e,f,...)
where
the ...
denotes more items of the same
format. The a,b,c...
are left-hand side arguments,
and the d,e,f...
are right-hand side arguments.
The arguments nlhs
and nrhs
contain
the number of left-hand side and right-hand side arguments,
respectively. prhs
is
an array of mxArray
pointers whose length is nrhs
. plhs
is
an array whose length is nlhs
, where your function
must set pointers for the returned left-hand side mxArray
s.
Examples
See t
Ïà¹ØÎĵµ£º
Cר¼Ò±à³Ì ¾«±àÖ®Ò» µÚÒ»ÕÂ~µÚÈýÕÂ
CµÄ¸´ÔÓÖ®´¦ ÔÚÓÚËüµÄÖ¸Õë ,µ«ÊDZÈÆäÖ¸Õë¸üΪ¸´ÔÓµÄÊÇËüµÄÉùÃ÷ !!!
ÄãÄÜ¿´¶®ËüÃǵÄÒâ˼ Âð?
apple=sizeof(int)*p ; apple=sizeof * p;
j= (char (*)[20])malloc(20);
int const * grape; Óë int * const gr ......
³ÌÐò¿ªÍ·ÒªÉùÃ÷
#include <string.h>
º¯ÊýÃû: stpcpy
¹¦ ÄÜ: ¿½±´Ò»¸ö×Ö·û´®µ½ÁíÒ»¸ö
ÓÃ ·¨: char *stpcpy(char *destin, char *source);
³ÌÐòÀý:
#include <stdio.h>
#include <string.h>
int main(void)
{
char string[10];
char *str1 = "abcdefghi";
&n ......
̸µ½EclipseÕâ¸ö¿ªÔ´IDE£¬´ó¼Ò¶¼»áDZÒâʶµØ°ÑËüºÍJAVA¿ª·¢ÁªÏµÆðÀ´¡£Ã»´í£¬EclipseÓÃÓÚJAVA applicationµÄ¿ª·¢ÊÇÄ¿Ç°µÄÖ÷Á÷£¬¶øÇÒËü±¾ÉíÒ²ÊÇÐèÒªJRE²ÅÄÜÔËÐеģ¬Òò¶øÎÞÂÛÔõô¿´Eclipse¶¼ÓëJAVAÓÐÃܲ»¿É·ÖµÄÁªÏµ¡£ µ«Êµ¼ÊÉÏEclipseÖ»ÊÇÒ»¸ö¿ª·¢»·¾³£¬Ò»¸öΪ³ÌÐòÔ±ÌṩµÄ¿ò¼Ü£¬ÓëÓïÑÔ²¢ÎÞÖ±½ÓÁªÏµ¡£×Ô´Ó2001ÄêIBM½«Eclipse¾èÏ ......
ÕâƪÈÕÖ¾»¹ÊÇÏÈ´ÓÒ»¸öÄܹ»ÔËÐÐÆðÀ´µÄÀý×Ó³ö·¢£¬Ò»µ©ÄÜ˳ÀûµÄ¿´µ½³ÌÐòµÄ³É¹¦ÔËÐУ¬ÄÇô½ÓÏÂÀ´µÄʼþÎÒÏëÓ¦¸ÃÊÇÎÊΪʲôÁË£¿ËƺõÕâÑù¸ü¼ÓÈÝÒ×Àí½âºÍÕÆÎÕ¡£
¶ÔÓÚsocket³ÌÐòµÄ¸ÅÄîÕâÀï¾Í²»¶àдÁË£¬µ«ÎÒÏàÐÅ£¬Èç¹ûÄÜ¿´ÍêÕâÕûƪÎÄÕ£¬ÎÒÏàÐŲ»»áÔÙÓÐÕâÑùµÄÒÉÎʵġ£
ÏÂÃ潫±àдһ¸öc/s½á¹¹µÄ³ÌÐò£¬Ö÷Òª¹¦ÄÜÊÇclient½«Ïòserver·¢Ë ......