# mexFunction

## Purpose

Entry point to a MEX-file.

## C Synopsis

    #include "mex.h"
    void mexFunction(nlhs,plhs,nrhs,prhs)
      int nlhs;
      Matrix *plhs[];
      int nrhs;
      Matrix *prhs[];

## Fortran Synopsis

    subroutine mexFunction(nlhs,plhs,nrhs,prhs)
    integer*4 nlhs,nrhs,plhs(*),prhs(*)

## Arguments

`nlhs`
  number of output Matrices
`nrhs`
  number of input Matrices
`plhs`
  pointer array for output Matrices
`prhs`
  pointer array for input Matrices

## Description

`mexFunction` is not a routine you can call in the External Interface Library, rather it is the entry point to the MEX-file gateway routine. The arguments contain the MATLAB arguments with which you invoke the MEX-function. 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, with which the MEX-function is called. `prhs` is a pointer to a length `nrhs` array of pointers to the right-hand side Matrices. `plhs` is a pointer to a length `nlhs` array where your C function must put pointers for the returned left-hand side Matrices.

(c) Copyright 1994 by The MathWorks, Inc.