=matlab 工具 mex= *mex 主要是讓Maltab和C語言、Fortran語言作溝通,Matlab程式中把引數對應好就可以利用C、Fortran幫我們做運算。[[br]] 進入mexfunction我們就可以寫C、Fortran程式了。然而若可以寫C程式,這樣的話我們也可以利用GPU來做運算。[[br]] 以下舉例一個範例。利用Matlab輸入兩個方陣,作相加。 mexFunction的框架如下: void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) { ....可以撰寫C、Fortran程式 } nlhs(Type = int): number of "left hand side" arguments (呼叫函式時,等號左邊的變數數目,即 plhs 之個數)[[br]] plhs(Type = array of pointers to mxArrays): actual output arguments (呼叫函式時,等號左邊之變數本體)[[br]] nrhs(Type = int): number of "right hand side" arguments (呼叫函式時,等號右邊的變數數目,即 prhs 之個數)[[br]] prhs(Type = const array of pointers to mxArrays): all of the pointers to the mxArrays of input data for instance (呼叫函式時,等號右邊之變數本體[[br]]