Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: mexfunction
Replies: 2   Last Post: Apr 8, 2013 2:39 AM

 Messages: [ Previous | Next ]
 Elnaz Sadeghian Posts: 206 From: Tehran, Iran Registered: 5/26/07
mexfunction
Posted: Apr 7, 2013 5:56 PM

Hi all,

My function defined in C has two outputs but when I call it from MATLAB command line it only returns the first output.
I am calling mexfunction gateway for my 3 input, 2 output function as:
void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
{
double *in1, *in2, *out1, *out2;
int in3;
size_t mrows,ncols;
mrows=mxGetM(prhs[0]); ncols=mxGetN(prhs[0]);
length = (int) ncols;
/* Create matrix for the return argument. */
plhs[0] = mxCreateDoubleMatrix((mwSize)mrows, (mwSize)ncols, mxREAL);
plhs[1] = mxCreateDoubleMatrix((mwSize)mrows, (mwSize)ncols, mxREAL);

/* Assign pointers to each input and output. */
in1= mxGetPr(prhs[0]);
in2= mxGetPr(prhs[1]);
out1= mxGetPr(plhs[0]);
out2= mxGetPr(plhs[1]);

/* Call the bcjr_decoder subroutine. */
my-func(in1, in2, in3, out1, out2);
}

How can I get it to return the both?

Thanks,
Elnaz

Date Subject Author