00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include "mex.h"
00024
00025 void
00026 mexFunction (int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[])
00027 {
00028 double handle;
00029 char property[256];
00030
00031 if (nrhs < 2 || nrhs > 3)
00032 mexErrMsgTxt ("incorrect number of arguments");
00033 if (!mxIsDouble(prhs[0]))
00034 mexErrMsgTxt ("handle expected to be a double scalar");
00035 if (!mxIsChar (prhs[1]))
00036 mexErrMsgTxt ("expected property to be a string");
00037
00038 handle = mxGetScalar (prhs[0]);
00039 mxGetString (prhs[1], property, 256);
00040 plhs[0] = mxDuplicateArray (mexGet (handle, property));
00041
00042 if (nrhs == 3)
00043 if (mexSet (handle, property, mxDuplicateArray (prhs[2])))
00044 mexErrMsgTxt ("failed to set property");
00045 }
00046
00047