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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6593
3da1f4a41455 [project @ 2007-04-27 08:08:19 by dbateman]
dbateman
parents:
diff changeset
1 #include "mex.h"
3da1f4a41455 [project @ 2007-04-27 08:08:19 by dbateman]
dbateman
parents:
diff changeset
2
3da1f4a41455 [project @ 2007-04-27 08:08:19 by dbateman]
dbateman
parents:
diff changeset
3 void
3da1f4a41455 [project @ 2007-04-27 08:08:19 by dbateman]
dbateman
parents:
diff changeset
4 mexFunction (int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[])
3da1f4a41455 [project @ 2007-04-27 08:08:19 by dbateman]
dbateman
parents:
diff changeset
5 {
3da1f4a41455 [project @ 2007-04-27 08:08:19 by dbateman]
dbateman
parents:
diff changeset
6 int n, i;
3da1f4a41455 [project @ 2007-04-27 08:08:19 by dbateman]
dbateman
parents:
diff changeset
7
3da1f4a41455 [project @ 2007-04-27 08:08:19 by dbateman]
dbateman
parents:
diff changeset
8 if (nrhs != 1 || ! mxIsCell (prhs[0]))
3da1f4a41455 [project @ 2007-04-27 08:08:19 by dbateman]
dbateman
parents:
diff changeset
9 mexErrMsgTxt ("expects cell");
3da1f4a41455 [project @ 2007-04-27 08:08:19 by dbateman]
dbateman
parents:
diff changeset
10
3da1f4a41455 [project @ 2007-04-27 08:08:19 by dbateman]
dbateman
parents:
diff changeset
11 n = mxGetNumberOfElements (prhs[0]);
3da1f4a41455 [project @ 2007-04-27 08:08:19 by dbateman]
dbateman
parents:
diff changeset
12 n = (n > nlhs ? nlhs : n);
3da1f4a41455 [project @ 2007-04-27 08:08:19 by dbateman]
dbateman
parents:
diff changeset
13
3da1f4a41455 [project @ 2007-04-27 08:08:19 by dbateman]
dbateman
parents:
diff changeset
14 for (i = 0; i < n; i++)
3da1f4a41455 [project @ 2007-04-27 08:08:19 by dbateman]
dbateman
parents:
diff changeset
15 plhs[i] = mxDuplicateArray (mxGetCell (prhs[0], i));
3da1f4a41455 [project @ 2007-04-27 08:08:19 by dbateman]
dbateman
parents:
diff changeset
16 }