title: How to allocate memory for 3 band or monochrome image in Mex gateway function?
body: <p>Usually I use below function to allocate memory for 3 band and monochrome image</p>
  
  <pre><code>/* For 3 band image */    
  plhs[0] = mxCreateNumericArray(3, dim_array, mxDOUBLE_CLASS, mxREAL);
  
  /*For monochrome image */
  plhs[0] = mxCreateDoubleMatrix(r,c,mxREAL);
  </code></pre>
  
  <p>that would be the case when we know the value of row(r), column(c) and dim_array. What if we don't know the value of r, c and dim_array?? It sounds stupid question...but what I am trying to do is I want to read an image from a file location. My Matlab function would be like</p>
  
  <pre><code>outputImage = imageRead('C:\abc\def\ghi.bmp');
  </code></pre>
  
  <p>I am just passing character string as input I cannot get the value of r, c and dim_array from the input, but we have to allocate memory for the output image in the main gateway function. How can we allocate the memory for this output image???</p>