Revision 756, 1.1 kB
(checked in by mido, 15 years ago)
|
odladen FindMatlab?.cmake
trida UImxConfig smazana a nahrazena statickou funkci UImxArray::create_mxArray(), a podle toho upravene zdrojaky
odstranen abort ze shared pointeru
|
Line | |
---|
1 | /*! |
---|
2 | \file |
---|
3 | \brief wrapper function for epdf.sample_mat() |
---|
4 | |
---|
5 | |
---|
6 | */ |
---|
7 | |
---|
8 | #include <stat/emix.h> |
---|
9 | |
---|
10 | using namespace bdm; |
---|
11 | |
---|
12 | #ifdef MEX |
---|
13 | #include <mex/mex_parser.h> |
---|
14 | |
---|
15 | void 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 | "mat=pdf_sample_mat(pdf_struct, nos)\n" |
---|
19 | " pdf_struct = struct('class','pdf_offspring',...); % description of pdf\n" |
---|
20 | " nos = 10; % number of samples\n" |
---|
21 | "output:\n" |
---|
22 | " matrix of samples, each sample in one column." ); |
---|
23 | |
---|
24 | RV::clear_all(); |
---|
25 | //CONFIG |
---|
26 | UImxArray Cfg(input[0]); |
---|
27 | Cfg.writeFile("epdf_sample_mat.cfg"); |
---|
28 | shared_ptr<epdf> ep=UI::build<epdf>(Cfg); |
---|
29 | |
---|
30 | int nos=10; |
---|
31 | if (n_input>1) {nos = (int)(*mxGetPr(input[1]));} |
---|
32 | |
---|
33 | if ( n_output<1 ) mexErrMsgTxt ( "No output - nothing to do!" ); |
---|
34 | output[0] = mxCreateDoubleMatrix(ep->dimension(), nos, mxREAL); |
---|
35 | mat2mxArray(ep->sample_mat(nos), output[0]); |
---|
36 | } |
---|
37 | #endif |
---|