Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.
|
|
Math Forum
»
Discussions
»
Software
»
comp.soft-sys.matlab
Notice: We are no longer accepting new posts, but the forums will continue to be readable.
Topic:
How to output a 2D integer array using Matlab mex?
Replies:
1
Last Post:
Feb 15, 2014 5:38 AM
|
 |
|
Aaronne
Posts:
110
Registered:
6/2/11
|
|
Re: How to output a 2D integer array using Matlab mex?
Posted:
Feb 15, 2014 5:38 AM
|
|
I got the answer with the help from someone. I put it here for others' reference.
// Output the results plhs[0] = mxCreateNumericMatrix(col_outputBuff, row_outputBuff, mxINT32_CLASS, mxREAL); int* outputMatrix = (int *)mxGetData(plhs[0]); // Read in the data for (int col=0; col < col_outputBuff; col++) { for (int row=0; row < row_outputBuff; row++) { outputMatrix[row + col*row_outputBuff] = outputBuff[col][row]; } }
|
|
|
|