6595
|
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 |