Mercurial > hg > octave-nkf
annotate examples/mycell.c @ 6593:3da1f4a41455
[project @ 2007-04-27 08:08:19 by dbateman]
author | dbateman |
---|---|
date | Fri, 27 Apr 2007 08:08:19 +0000 |
parents | |
children | 2aad75fcc93a |
rev | line source |
---|---|
6593 | 1 #include "mex.h" |
2 | |
3 void | |
4 mexFunction (int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]) | |
5 { | |
6 int n, i; | |
7 | |
8 if (nrhs != 1 || ! mxIsCell (prhs[0])) | |
9 mexErrMsgTxt ("expects cell"); | |
10 | |
11 n = mxGetNumberOfElements (prhs[0]); | |
12 n = (n > nlhs ? nlhs : n); | |
13 | |
14 for (i = 0; i < n; i++) | |
15 plhs[i] = mxDuplicateArray (mxGetCell (prhs[0], i)); | |
16 } |