/* Function accepts a slot number and returns a value representing the type of National Instruments card in that slot. See file Board_ID.m for more documentation. Allen W. Ingling 7/23/99 History 7/23/99 awi created file 4/27/00 awi moved to CW Pro 5, removed #include for utility.h . */ // includes for mex API #include "mex.h" // includes for NIDaq API //#include //#include #include "nidaq.h" /* mexFunction is the gateway routine for the MEX-file. */ void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] ) { int mrows,ncols; double *rsltPntr1, *rsltPntr2; double inpt; i32 error, brd; i16 brdType; // check to be sure that a valid argument was passed if (nrhs !=1) { mexErrMsgTxt("One input required."); } mrows = mxGetM(prhs[0]); ncols = mxGetN(prhs[0]); if (!mxIsDouble(prhs[0]) || mxIsComplex(prhs[0]) || !(mrows == 1 && ncols == 1)) { mexErrMsgTxt("Input must be a noncomplex scalar double"); } // put something here to make sure the input is an integer // // create matrices for the return arguments plhs[0] = mxCreateDoubleMatrix(1,1,mxREAL); rsltPntr1 = mxGetPr(plhs[0]); if (nlhs == 2) { plhs[1] = mxCreateDoubleMatrix(1,1,mxREAL); rsltPntr2 = mxGetPr(plhs[1]); } // call the NIDaq function and load results into return variables. inpt = mxGetScalar(prhs[0]); error = Board_ID((i32)inpt, &brdType); *rsltPntr1 = (double)brdType; if (nlhs == 2) { *rsltPntr2 = (double)error; } }