#include "lsl_common.h" /* function [IsEmpty] = lsl_empty(LibHandle,DescPtr) */ void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray*prhs[] ) { /* handle of the desired field */ mxArray *field; /* temp pointer */ uintptr_t *pTmp; /* function handle */ lsl_empty_t func; /* input/output variables */ xml_ptr in; int out; if (nrhs != 2) mexErrMsgTxt("2 input argument(s) required."); if (nlhs != 1) mexErrMsgTxt("1 output argument(s) required."); /* get function handle */ field = mxGetField(prhs[0],0,"lsl_empty"); if (!field) mexErrMsgTxt("The field does not seem to exist."); pTmp = (uintptr_t*)mxGetData(field); if (!pTmp) mexErrMsgTxt("The field seems to be empty."); func = (lsl_empty_t*)*pTmp; /* get additional inputs */ in = (xml_ptr)*(uintptr_t*)mxGetData(prhs[1]); /* invoke & return */ out = func(in); plhs[0] = mxCreateNumericMatrix(1,1,mxDOUBLE_CLASS,mxREAL); *(double*)mxGetData(plhs[0]) = (double)out; }