close
Warning:
Can't synchronize with repository "(default)" (Unsupported version control system "svn": /usr/lib/python2.7/dist-packages/libsvn/_core.so: failed to map segment from shared object: Cannot allocate memory). Look in the Trac log for more information.
- Timestamp:
-
Jul 17, 2010, 9:14:04 PM (14 years ago)
- Author:
-
adherelinux
- Comment:
-
--
Legend:
- Unmodified
- Added
- Removed
- Modified
-
v4
|
v5
|
|
5 | 5 | 進入mexfunction我們就可以寫C、Fortran程式了。然而若可以寫C程式,這樣的話我們也可以利用GPU來做運算。[[br]] |
6 | 6 | 以下舉例一個範例。利用Matlab輸入兩個方陣,作相加。 |
| 7 | mexFunction的框架如下: |
| 8 | void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) |
| 9 | { |
| 10 | ....可以撰寫C、Fortran程式 |
| 11 | } |
| 12 | |
| 13 | nlhs(Type = int): number of "left hand side" arguments (呼叫函式時,等號左邊的變數數目,即 plhs 之個數)[[br]] |
| 14 | |
| 15 | plhs(Type = array of pointers to mxArrays): actual output arguments (呼叫函式時,等號左邊之變數本體)[[br]] |
| 16 | |
| 17 | nrhs(Type = int): number of "right hand side" arguments (呼叫函式時,等號右邊的變數數目,即 prhs 之個數)[[br]] |
| 18 | |
| 19 | prhs(Type = const array of pointers to mxArrays): all of the pointers to the mxArrays of input data for instance (呼叫函式時,等號右邊之變數本體[[br]] |
| 20 | |