There are various components in the generated C MEX file. Please refer to the following link for more information on the components:
mxArray is part of one of the components defined in the link above. mxArray is C type for MATLAB array. While creating mxArray, there is a need to pass the size of mxArray as well as the data-type of mxArray. Please refer to the following code that defines mxArray in on the generated C code:
int numPts = (int) mxGetNumberOfElements(prhs[0]);
mxArray * labelsMx = mxCreateNumericMatrix(numPts, 1, mxINT32_CLASS, mxREAL);
int* labels = (int*) mxGetData(labelsMx);
Here numPts is defined by passing the size through command line at the time of calling the MEX C file. mxINT32_CLASS states that the data-type of the labelsMx is int32 (MATLAB data-type). And then at the final step the labelsMx is linked to lables variable in C that is of data-type int. So, here variable “labels” is the array of data-type int and size numPts.
Please refer to the following link for more information on mxCreateNumericMatrix and mxGetData:
Hope this helps!