title: Array of int at the output of a mex file
body: <p>I am trying to create a mex function whose entry is an integer and whose output is an array of integer. 
  So the function looks like: int *myFunction(unsigned int N).
  In the mexFunction, I declare a variable *variab of type int and then</p>
  
  <pre><code>N = mxGetScalar(prhs[0]);
  
    /* assign a pointer to the output */
    siz= 2*ceil(log(1.0*N)/log(2.0)-0.5)+1;
    plhs[0] = mxCreateDoubleMatrix(1,siz, mxREAL);
    vari = (int*) mxGetPr(plhs[0]); */
    /* Call the subroutine. */
    vari = myFunction(N);
    mexPrintf("The first value is %d\n", vari[0]);
  </code></pre>
  
  <p>The thing is the first value is the correct one (and the other ones were checked and were correct as well) but when I call the routine mxFunction(16), I get only 0's as output. 
  I guess it is because my output is an array of int but I don't know how to solve the problem. Any hint?
  Cheers.</p>