|
"Prasad " <pt2091@gmail.com> wrote in message <kac771$60k$1@newscl01ah.mathworks.com>...
(snip)
> void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
> {
> double *y;
>
> y = mxGetPr(plhs[0]);
> y[0]= connect();
>
> return;
> }
The above mxGetPr(plhs[0]) call will bomb MATLAB since plhs[0] doesn't exist (you haven't created it yet). You need to create plhs[0] before using it. E.g., add this as your first line:
plhs[0] = mxCreateDoubleMatrix(1,1,mxREAL);
then you can go get the data pointer with mxGetPr(plhs[0]). Or, more simply, you could replace all of the above with one line:
plhs[0] = mxCreateDoubleScalar(connect());
> The NuiApi.h is located in the same directory as the connect.cpp file. I have placed one library file that contains the 'Kinect10.lib' file in several directories including the working directory.
>
> This is the command used to compile connect.cpp:
>
> mex -v connect.cpp -lKinect10
Since Kinect10.lib is already in your working directory, try explicitly including it in the mex command. E.g.,
mex -v connect.cpp Kinect10.lib
James Tursa
|