Mercurial > hg > octave-nkf
annotate examples/code/myprop.c @ 19827:e68267373191
chop.m: Calculate deflate as 1./inflate (bug #43734).
chop.m: Calculate deflate as 1./inflate (bug #43734).
author | Rik <rik@octave.org> |
---|---|
date | Sat, 24 Jan 2015 22:27:12 -0800 |
parents | c8240a60dd01 |
children | 5c42ff6f0eb1 |
rev | line source |
---|---|
6595 | 1 #include "mex.h" |
2 | |
3 void | |
16867
be41c30bcb44
Re-write documentation and all examples of dynamically linked functions.
Rik <rik@octave.org>
parents:
14855
diff
changeset
|
4 mexFunction (int nlhs, mxArray* plhs[], |
be41c30bcb44
Re-write documentation and all examples of dynamically linked functions.
Rik <rik@octave.org>
parents:
14855
diff
changeset
|
5 int nrhs, const mxArray* prhs[]) |
6595 | 6 { |
7 double handle; | |
8 char property[256]; | |
9 | |
10 if (nrhs < 2 || nrhs > 3) | |
11 mexErrMsgTxt ("incorrect number of arguments"); | |
14855
1b48b209a8d6
maint: Use Octave coding conventions for coddling parentheses in examples directory
Rik <octave@nomad.inbox5.com>
parents:
9053
diff
changeset
|
12 if (!mxIsDouble (prhs[0])) |
6595 | 13 mexErrMsgTxt ("handle expected to be a double scalar"); |
14 if (!mxIsChar (prhs[1])) | |
15 mexErrMsgTxt ("expected property to be a string"); | |
17791
224e76250443
Use GNU style coding conventions for code in examples/
Rik <rik@octave.org>
parents:
16867
diff
changeset
|
16 |
6595 | 17 handle = mxGetScalar (prhs[0]); |
18 mxGetString (prhs[1], property, 256); | |
19 plhs[0] = mxDuplicateArray (mexGet (handle, property)); | |
17791
224e76250443
Use GNU style coding conventions for code in examples/
Rik <rik@octave.org>
parents:
16867
diff
changeset
|
20 |
6595 | 21 if (nrhs == 3) |
22 if (mexSet (handle, property, mxDuplicateArray (prhs[2]))) | |
23 mexErrMsgTxt ("failed to set property"); | |
24 } |