root/matlab/mex/sumitpp.cpp @ 116

Revision 116, 0.8 kB (checked in by smidl, 16 years ago)

MEX linking with bdm

  • Property svn:eol-style set to native
Line 
1#include <itpp/itcomm.h>
2#include <itpp/itmex.h>
3
4#include <../../bdm/estim/arx.h>
5
6using namespace itpp;
7
8void mexFunction ( int n_output, mxArray *output[], int n_input, const mxArray *input[] ) {
9        // Check the number of inputs and output arguments
10        if ( n_output!=1 ) mexErrMsgTxt ( "Wrong number of output variables!" );
11        if ( n_input!=1 ) mexErrMsgTxt ( "Wrong number of input variables!" );
12
13        // Convert input variables to IT++ format
14        mat Data = mxArray2mat ( input[0] );
15        vec mn;
16        // ------------------ Start of routine ---------------------------
17       
18        mn = sum(Data);
19       
20       
21        // ------------------ End of routine -----------------------------
22
23        // Create output vectors
24        output[0] = mxCreateDoubleMatrix ( 1,mn.length(), mxREAL );
25
26        // Convert the IT++ format to Matlab format for output
27        vec2mxArray ( mn, output[0] );
28}
Note: See TracBrowser for help on using the browser.