root/applications/bdmtoolbox/mex/epdf_mean.cpp @ 728

Revision 728, 1.0 kB (checked in by smidl, 15 years ago)

logger now has ability to store settings - used in estimator. New mexfunction epdf_mean

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