Mercurial > hg > octave-nkf
annotate examples/mycell.c @ 18151:91a3858ef8cf stable
invoke versioned binaries from octave driver program (bug #40957)
* main.in.cc (OCTAVE_VERSION): New macro.
(main) Append OCTAVE_VERSION to exec file name. Always set
new_argv[0] to full name of file that is executed.
* Makefile.am (octave-cli-$(version), octave-gui-$(version),
all-local): New rules.
(OCTAVE_VERSION_LINKS): New variable.
(CLEANFILES): Include $(OCTAVE_VERSION_LINKS) in the list.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 19 Dec 2013 15:24:28 -0500 |
parents | 224e76250443 |
children |
rev | line source |
---|---|
6593 | 1 #include "mex.h" |
2 | |
3 void | |
16867
be41c30bcb44
Re-write documentation and all examples of dynamically linked functions.
Rik <rik@octave.org>
parents:
9932
diff
changeset
|
4 mexFunction (int nlhs, mxArray* plhs[], |
be41c30bcb44
Re-write documentation and all examples of dynamically linked functions.
Rik <rik@octave.org>
parents:
9932
diff
changeset
|
5 int nrhs, const mxArray* prhs[]) |
6593 | 6 { |
6686 | 7 mwSize n; |
8 mwIndex i; | |
6593 | 9 |
10 if (nrhs != 1 || ! mxIsCell (prhs[0])) | |
16867
be41c30bcb44
Re-write documentation and all examples of dynamically linked functions.
Rik <rik@octave.org>
parents:
9932
diff
changeset
|
11 mexErrMsgTxt ("ARG1 must be a cell"); |
6593 | 12 |
13 n = mxGetNumberOfElements (prhs[0]); | |
14 n = (n > nlhs ? nlhs : n); | |
17791
224e76250443
Use GNU style coding conventions for code in examples/
Rik <rik@octave.org>
parents:
16867
diff
changeset
|
15 |
6593 | 16 for (i = 0; i < n; i++) |
17 plhs[i] = mxDuplicateArray (mxGetCell (prhs[0], i)); | |
18 } |