5864
|
1 subroutine mexFunction (nlhs, plhs, nrhs, prhs) |
|
2 |
|
3 implicit none |
|
4 |
|
5 integer*4 nlhs, nrhs |
|
6 |
|
7 * The following will need to be integer*8 on 64-bit systems, otherwise |
|
8 * these variables won't be large enough to hold pointers... |
|
9 integer*4 plhs(*), prhs(*) |
|
10 |
|
11 integer*4 mxIsString, mxGetString, mxGetN, mexCallMATLAB |
|
12 integer*4 status, len |
|
13 character*100 str |
|
14 |
|
15 call mexPrintf ('Hello, World!') |
|
16 |
|
17 if (nrhs .lt. 1 .or. mxIsString (prhs(1)) .ne. 1) then |
|
18 call mexErrMsgTxt ('function name expected') |
|
19 endif |
|
20 |
|
21 len = mxGetN (prhs(1)) |
|
22 |
|
23 status = mxGetString (prhs(1), str, 100) |
|
24 |
|
25 call mexPrintf ('FORTRAN will call the interpreter now') |
|
26 |
|
27 status = mexCallMATLAB (nlhs, plhs, nrhs-1, prhs(2), str(1:len)) |
|
28 |
|
29 return |
|
30 end |