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