6593
|
1 #include <string.h> |
|
2 #include "mex.h" |
|
3 |
|
4 void |
|
5 mexFunction (int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) |
|
6 { |
6686
|
7 mwIndex i, j; |
|
8 mwSize m, n; |
6593
|
9 mxChar *pi, *po; |
|
10 |
|
11 if (nrhs != 1 || ! mxIsChar (prhs[0]) || |
|
12 mxGetNumberOfDimensions (prhs[0]) > 2) |
|
13 mexErrMsgTxt ("expecting char matrix"); |
|
14 |
|
15 m = mxGetM (prhs[0]); |
|
16 n = mxGetN (prhs[0]); |
|
17 pi = mxGetChars (prhs[0]); |
|
18 plhs[0] = mxCreateNumericMatrix (m, n, mxCHAR_CLASS, mxREAL); |
|
19 po = mxGetChars (plhs[0]); |
|
20 |
|
21 for (j = 0; j < n; j++) |
|
22 for (i = 0; i < m; i++) |
|
23 po [j*m + m - 1 - i] = pi [j*m + i]; |
|
24 } |