Revision 659, 1.2 kB
(checked in by mido, 15 years ago)
|
synchronization of documentation pages names
|
Line | |
---|
1 | /*! |
---|
2 | \page mexfiles How to write and use mex files for Matlab |
---|
3 | |
---|
4 | \section use Howto use predefined mexfiles |
---|
5 | |
---|
6 | A range of mexfiles is predefined in directory \c library/mex. |
---|
7 | Many of these mexfile process ui files (see \ref ui) examples of these files are in directory \c library/tutorial. |
---|
8 | Note that in order to run these files you need to let matlab know where to find them: |
---|
9 | \code |
---|
10 | >> addpath path_to_bdm/library/mex |
---|
11 | \endcode |
---|
12 | |
---|
13 | Then, you can go to \c library/tutorial and run e.g. \c arx_test_mex. |
---|
14 | |
---|
15 | \section write Howto write custom mex file |
---|
16 | |
---|
17 | Due to special nature of the mex files, the mex file can be split in three parts: |
---|
18 | \li input conversion, where input arguments are converted to IT++ structures, |
---|
19 | \li main body of algorithm, where any C++ bdm constructions can be used, |
---|
20 | \li output conversion, where resulting IT++ structures are converted to mxArrays. |
---|
21 | |
---|
22 | The first and the third part is achieved using prepared IT++ routines, see IT++ documentation. |
---|
23 | |
---|
24 | Script \c ./buildmex is prepared to compile and link the mexfile with bdm. |
---|
25 | \code |
---|
26 | $ ./buildmex.sh my_mex_file.cpp |
---|
27 | \endcode |
---|
28 | on Linux, or |
---|
29 | \code |
---|
30 | $ ./buildmex.bat my_mex_file.cpp |
---|
31 | \endcode |
---|
32 | on Windows. |
---|
33 | |
---|
34 | Example of a mexfile: |
---|
35 | \include arx1d.cpp |
---|
36 | */ |
---|