Revision 925, 1.0 kB
(checked in by smidl, 14 years ago)
|
new mexpdf
|
Rev | Line | |
---|
[728] | 1 | /*! |
---|
| 2 | \file |
---|
| 3 | \brief wrapper function for epdf.mean() |
---|
| 4 | |
---|
| 5 | |
---|
| 6 | */ |
---|
| 7 | |
---|
| 8 | #include <stat/emix.h> |
---|
| 9 | |
---|
| 10 | using namespace bdm; |
---|
| 11 | |
---|
| 12 | #ifdef MEX |
---|
| 13 | #include <mex/mex_parser.h> |
---|
[925] | 14 | #include "mexPdf.h" |
---|
[728] | 15 | |
---|
| 16 | void mexFunction ( int n_output, mxArray *output[], int n_input, const mxArray *input[] ) { |
---|
| 17 | // Check the number of inputs and output arguments |
---|
| 18 | if ( n_input<1 ) mexErrMsgTxt ( "Usage:\n" |
---|
| 19 | "vec=pdf_mean(pdf_struct)\n" |
---|
| 20 | " pdf_struct = struct('class','pdf_offspring',...); % description of pdf\n" |
---|
| 21 | "output:\n" |
---|
| 22 | " vec mean value of given pdf." ); |
---|
| 23 | |
---|
| 24 | RV::clear_all(); |
---|
| 25 | //CONFIG |
---|
| 26 | UImxArray Cfg(input[0]); |
---|
[925] | 27 | Cfg.writeFile("epdf_mean.cfg"); |
---|
[728] | 28 | |
---|
[756] | 29 | shared_ptr<epdf> ep=UI::build<epdf>(Cfg); |
---|
[728] | 30 | |
---|
[796] | 31 | if (ep){ |
---|
| 32 | //if ( n_output<1 ) mexErrMsgTxt ( "No output - nothing to do!" ); |
---|
| 33 | output[0] = mxCreateDoubleMatrix(ep->dimension(), 1, mxREAL); |
---|
| 34 | vec2mxArray(ep->mean(), output[0]); |
---|
| 35 | } else { |
---|
| 36 | mexErrMsgTxt ( "Given object is not epdf" ); |
---|
| 37 | } |
---|
[728] | 38 | } |
---|
| 39 | #endif |
---|