void RcallWextIextToSegments ( double *Wext, //Input and output breakpoint weights int *Iext, //Input and output breakpoint locations int *K, // Input and output numof breakpoints double *SegAmp, // Segment amplitudes int *SegLen // Segment lengths ) { // Rprintf("# WextIextToSegments -- %d discontinuities \n",*K); IextToSegLen(Iext,SegLen,*K); IextWextToSegAmp(Iext,Wext,SegAmp,*K); }
void mexFunction(int nlhs,mxArray *plhs[],int nrhs,const mxArray *prhs[]) { /* VARIABLES DECLARATION */ int *Iext; int K,k; double *SegAmp; double *Wext; // Checking number of input/output parameters if (nrhs != 2){ mexErrMsgTxt("2 input arguments are required"); } if (nlhs != 1) { mexErrMsgTxt("1 output arguments are required"); } /* Getting Input parameters */ Iext=(int*)mxGetPr(prhs[0]); Wext=mxGetPr(prhs[1]); K = mxGetNumberOfElements(prhs[0])-2; //Check Iext and Wext // Preparing output results plhs[0]=mxCreateDoubleMatrix(1,K+1,mxREAL); // SegAmp= mxGetPr(plhs[0]); // plhs[i]= mxCreateNumericMatrix(1,K+1,mxUINT32_CLASS,mxREAL); //I // SegLen= (int*) mxGetPr(plhs[i++]); IextWextToSegAmp(Iext,Wext,SegAmp,K); }