Changeset 296 for doc/html/mexfiles.html

Show
Ignore:
Timestamp:
03/17/09 13:54:06 (16 years ago)
Author:
smidl
Message:

doc

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • doc/html/mexfiles.html

    r290 r296  
    7676</pre></div> on Linux, or <div class="fragment"><pre class="fragment">$ ./buildmex.bat my_mex_file.cpp 
    7777</pre></div> on Windows.<p> 
    78 Example of a mexfile: <div class="fragment"><pre class="fragment"></pre></div> </div> 
    79 <hr size="1"><address style="text-align: right;"><small>Generated on Fri Mar 6 15:01:37 2009 for mixpp by&nbsp; 
     78Example of a mexfile: <div class="fragment"><pre class="fragment"><span class="preprocessor">#include &lt;itpp/itmex.h&gt;</span> 
     79<span class="preprocessor">#include &lt;<a class="code" href="arx_8h.html" title="Bayesian Filtering for generalized autoregressive (ARX) model.">estim/arx.h</a>&gt;</span> 
     80 
     81<span class="keyword">using namespace </span>bdm; 
     82 
     83<span class="keywordtype">void</span> mexFunction(<span class="keywordtype">int</span> n_output, mxArray *output[], <span class="keywordtype">int</span> n_input, <span class="keyword">const</span> mxArray *input[]) 
     84{ 
     85    <span class="comment">// Check the number of inputs and output arguments</span> 
     86        <span class="keywordflow">if</span>(n_output!=1) mexErrMsgTxt(<span class="stringliteral">"Wrong number of output variables!"</span>); 
     87        <span class="keywordflow">if</span>(n_input!=2) mexErrMsgTxt(<span class="stringliteral">"Usage: arx1d(ysize, Data)!"</span>); 
     88 
     89    <span class="comment">// Convert input variables to IT++ format</span> 
     90        <span class="keywordtype">int</span> ysize = mxArray2int(input[0]); 
     91        mat Data = mxArray2mat(input[1]); 
     92 
     93    <span class="comment">// ------------------ Start of routine ---------------------------</span> 
     94        ARX Ar; 
     95        Ar.set_statistics(ysize, 1e-5*eye(Data.rows()) ); 
     96        Ar.bayesB(Data); 
     97        <span class="comment">// ------------------ End of routine -----------------------------</span> 
     98 
     99    <span class="comment">// Create output vectors</span> 
     100        output[0] = mxCreateDoubleMatrix(1,Data.rows(), mxREAL); 
     101 
     102    <span class="comment">// Convert the IT++ format to Matlab format for output</span> 
     103        vec2mxArray(Ar.posterior().mean(), output[0]); 
     104} 
     105</pre></div> </div> 
     106<hr size="1"><address style="text-align: right;"><small>Generated on Tue Mar 17 13:51:49 2009 for mixpp by&nbsp; 
    80107<a href="http://www.doxygen.org/index.html"> 
    81108<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>