title: How to get two outputs from a Matlab C Mex function?
body: <p>I know how to write a basic C Mex function with one output of type double. I tried to write a C Mex with two outputs but I got segmentation violation errors. The first output is a double, the second an integer. Here is the code where I try to assign the output pointers:</p>
  
  <pre><code>plhs[0] = mxCreateDoubleMatrix(1, 1, mxREAL); //works fine
  plhs[1] = mxCreateNumericArray(1, 1, mxINT32_CLASS, mxREAL); //causes segmentation violation
  </code></pre>
  
  <p>I searched the internet, but almost all the examples have just one output or outputs of the same type. What should be done to get two outputs, one of type double, the other of type integer?</p>