The source code for a MEX-file consists of two distinct parts:
1.A computational routine that contains the code for performing the computations that you
want implemented in the MEX-file. Computations can be numerical computations as well
as inputting and outputting data.
2.A gateway routine that interfaces the computational routine with MATLAB by the entry
point mexFunction. The gateway calls the computational routine as a subroutine. In the
gateway routine, you can access the data in the mxArray structure and then manipulate this
data in your C computational subroutine. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.