Related posts:

1. Create a file in C format which a heading file of mex.h has to be added in order to interface with Matlab. Instead of staring from main() function, we use mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) to acquire and return the variables between C function and Matlab.