Mercurial > hg > octave-lyh
annotate examples/mycell.c @ 6686:2aad75fcc93a
[project @ 2007-06-03 20:58:28 by dbateman]
author | dbateman |
---|---|
date | Sun, 03 Jun 2007 20:58:29 +0000 |
parents | 3da1f4a41455 |
children | 4270ded9ddc6 |
rev | line source |
---|---|
6593 | 1 #include "mex.h" |
2 | |
3 void | |
4 mexFunction (int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]) | |
5 { | |
6686 | 6 mwSize n; |
7 mwIndex i; | |
6593 | 8 |
9 if (nrhs != 1 || ! mxIsCell (prhs[0])) | |
10 mexErrMsgTxt ("expects cell"); | |
11 | |
12 n = mxGetNumberOfElements (prhs[0]); | |
13 n = (n > nlhs ? nlhs : n); | |
14 | |
15 for (i = 0; i < n; i++) | |
16 plhs[i] = mxDuplicateArray (mxGetCell (prhs[0], i)); | |
17 } |