Mercurial > hg > octave-nkf
annotate examples/mystring.c @ 14300:d1c45dd1a038 gui
Readded .hgsub.
author | Jacob Dawid <jacob.dawid@googlemail.com> |
---|---|
date | Tue, 31 Jan 2012 21:32:43 +0100 |
parents | 6cb30a539481 |
children | be41c30bcb44 |
rev | line source |
---|---|
6593 | 1 #include <string.h> |
2 #include "mex.h" | |
3 | |
4 void | |
7081 | 5 mexFunction (int nlhs, mxArray *plhs[], int nrhs, |
9932
6cb30a539481
untabify files in examples directory
John W. Eaton <jwe@octave.org>
parents:
9053
diff
changeset
|
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, |
9932
6cb30a539481
untabify files in examples directory
John W. Eaton <jwe@octave.org>
parents:
9053
diff
changeset
|
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 } |