/*================================================================= * mexfunction.c * * This example demonstrates how to use mexFunction. It returns * the number of elements for each input argument, providing the * function is called with the same number of output arguments * as input arguments. * This is a MEX-file for MATLAB. * Copyright 1984-2011 The MathWorks, Inc. * All rights reserved. *=================================================================*/ #include "mex.h" void mexFunction(int nlhs,mxArray *plhs[],int nrhs,const mxArray *prhs[]) { int i; /* Examine input (right-hand-side) arguments. */ mexPrintf("\nThere are %d right-hand-side argument(s).", nrhs); for (i=0; i nrhs) mexErrMsgIdAndTxt( "MATLAB:mexfunction:inputOutputMismatch", "Cannot specify more outputs than inputs.\n"); for (i=0; i