#include "lsl_common.h" /* function [CreatedAt] = lsl_get_created_at(LibHandle,StreamInfo) */ 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_get_created_at_t func; /* input/output variables */ uintptr_t info; double created_at; 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_get_created_at"); 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_get_created_at_t*)*pTmp; /* get additional inputs */ info = *(uintptr_t*)mxGetData(prhs[1]); /* invoke & return */ created_at = func(info); plhs[0] = mxCreateNumericMatrix(1,1,mxDOUBLE_CLASS,mxREAL); *(double*)mxGetData(plhs[0]) = (double)created_at; }