22a23
> /* #define INPUTFILE       "/home/noio/programs/bathy/dbdb5.fin" */
32c33,39
< void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
---
> #ifdef USE_FUNCTION_PROTOTYPES
> void mexFunction(int nlhs,Matrix *plhs[], int nrhs,Matrix *prhs[])
> #else
> mexFunction(nlhs, plhs, nrhs, prhs)
>      int nlhs, nrhs;
>      Matrix *plhs[], *prhs[];
> #endif
37d43
<   int filename_len, status;
43a50
>   char *m2s();
45,47c52,58
<   filename_len = 1 + (mxGetM(prhs[0]) * mxGetN(prhs[0]));
<   filename = mxCalloc(filename_len, sizeof(char));
<   status = mxGetString(prhs[0], filename, filename_len);
---
> /***** 4 input arguments(latmin, latmax, lonmin, lonmax ****/
> /*  if(nrhs < 4){
>     mexErrMsgTxt("Need greater than 4 input arguments. Please input [latmin, latmax, lonmin, lonmax, m, n]");
>   } 
> */
> 
>   filename = m2s(prhs[0]);
86,88c97,99
<   plhs[0] = mxCreateDoubleMatrix(y_range, 1, mxREAL);
<   plhs[1] = mxCreateDoubleMatrix(x_range, 1, mxREAL);
<   plhs[2] = mxCreateDoubleMatrix(y_range, x_range, mxREAL); 
---
>   plhs[0] = mxCreateFull(y_range, 1, REAL);
>   plhs[1] = mxCreateFull(x_range, 1, REAL);
>   plhs[2] = mxCreateFull(y_range, x_range, REAL); 
95c106
<     sprintf(errMsg,"Data file >>%s<< can't be opened to read\n", filename); 
---
>     sprintf(errMsg,"%s can't be open to read\n", filename); 
101c112
<   if(!(buffer=(float *)mxCalloc((y2-y1+1) * NX,  sizeof(float)))){
---
>   if(!(buffer=(float *)malloc((y2-y1+1) * NX * sizeof(float)))){
131a143,164
> /* 
> **   m2s() - function to return string from MEX Matrix argument
> */
> 
> char   *m2s(mat)
>    Matrix	*mat;
> {
> 
>    double  *pr;
>    char    *str,*p;
>    int     len;
>    
>    len = mxGetN(mat);
>    str = (char *)calloc(len+1,sizeof(char));
>    p = str;
>    pr = mxGetPr(mat);
>    while (len--)
>       *p++ = (char)*pr++;
>    *p = '\0';
>    return(str);
> 
> } /* end of function m2s */
