Mercurial > octave-nkf
comparison examples/myprop.c @ 6595:55586d763de1
[project @ 2007-04-27 15:31:10 by dbateman]
author | dbateman |
---|---|
date | Fri, 27 Apr 2007 15:31:10 +0000 |
parents | |
children | 4270ded9ddc6 |
comparison
equal
deleted
inserted
replaced
6594:5843c11b4006 | 6595:55586d763de1 |
---|---|
1 #include "mex.h" | |
2 | |
3 void | |
4 mexFunction (int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]) | |
5 { | |
6 double handle; | |
7 char property[256]; | |
8 | |
9 if (nrhs < 2 || nrhs > 3) | |
10 mexErrMsgTxt ("incorrect number of arguments"); | |
11 if (!mxIsDouble(prhs[0])) | |
12 mexErrMsgTxt ("handle expected to be a double scalar"); | |
13 if (!mxIsChar (prhs[1])) | |
14 mexErrMsgTxt ("expected property to be a string"); | |
15 | |
16 handle = mxGetScalar (prhs[0]); | |
17 mxGetString (prhs[1], property, 256); | |
18 plhs[0] = mxDuplicateArray (mexGet (handle, property)); | |
19 | |
20 if (nrhs == 3) | |
21 if (mexSet (handle, property, mxDuplicateArray (prhs[2]))) | |
22 mexErrMsgTxt ("failed to set property"); | |
23 } | |
24 | |
25 |