Revision 937, 1.0 kB
(checked in by smidl, 15 years ago)
|
matlab class extension for pdf
|
Rev | Line | |
---|
[936] | 1 | class mexEpdf: public epdf{ |
---|
| 2 | protected: |
---|
| 3 | mxArray *data; |
---|
| 4 | public: |
---|
| 5 | mexEpdf() {}; |
---|
| 6 | void from_setting(const Setting &S) { |
---|
| 7 | Setting &So=S["object"]; |
---|
| 8 | data = (mxArray*)long(So); |
---|
| 9 | } |
---|
| 10 | void validate() { |
---|
[937] | 11 | mexCallMATLAB(0, 0, 1, &data, "validate"); |
---|
| 12 | mxArray *tmp; |
---|
| 13 | mexCallMATLAB(1, &tmp, 1, &data, "dimension"); |
---|
| 14 | dim = mxArray2double(tmp); |
---|
[936] | 15 | } |
---|
| 16 | vec mean() const { |
---|
| 17 | mxArray *tmp; |
---|
| 18 | mexCallMATLAB(1, &tmp, 1, (mxArray **) &data, "mean"); |
---|
| 19 | return mxArray2vec(tmp); |
---|
| 20 | } |
---|
| 21 | vec sample() const { |
---|
| 22 | mxArray *tmp; |
---|
| 23 | mexCallMATLAB(1, &tmp, 1, (mxArray **) &data, "sample"); |
---|
| 24 | return mxArray2vec(tmp); |
---|
| 25 | } |
---|
| 26 | double evallog(const vec &dt) const { |
---|
| 27 | mxArray *tmp; |
---|
[937] | 28 | mxArray *in[2]; |
---|
| 29 | in[0]=data; |
---|
| 30 | in[1]=mxCreateDoubleMatrix(dimension(),1,mxREAL); |
---|
| 31 | vec2mxArray(dt,in[1]); |
---|
| 32 | mexCallMATLAB(1, &tmp, 2, in, "evallog"); |
---|
[936] | 33 | return mxArray2double(tmp); |
---|
| 34 | } |
---|
| 35 | vec variance() const { |
---|
| 36 | mxArray *tmp; |
---|
| 37 | mexCallMATLAB(1, &tmp, 1, (mxArray **) &data, "variance"); |
---|
| 38 | return mxArray2vec(tmp); |
---|
| 39 | } |
---|
| 40 | }; |
---|
[937] | 41 | UIREGISTER(mexEpdf); |
---|