MATLAB REAL-TIME WORKSHOP 7 - TARGET LANGUAGE COMPILER Manuale Utente Pagina 133

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 408
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 132
Examples of Fortran MEX-Files
3-23
C==============================================================
C
C Computational subroutine
subroutine convec(x, y, z, nx, ny)
complex*16 x(*), y(*), z(*)
integer nx, ny
C Initialize the output array.
do 10 i=1,nx+ny-1
z(i) = (0.0,0.0)
10 continue
do 30 i=1,nx
do 20 j=1,ny
z(i+j-1) = z(i+j-1) + x(i) * y(j)
20 continue
30 continue
return
end
C The gateway routine.
subroutine mexFunction(nlhs, plhs, nrhs, prhs)
integer nlhs, nrhs
C--------------------------------------------------------------
C (pointer) Replace integer by integer*8 on the DEC Alpha
C platform.
C
integer plhs(*), prhs(*)
integer mxGetPr, mxGetPi, mxCreateFull
C--------------------------------------------------------------
C
integer mx, nx, my, ny, nz
integer mxGetM, mxGetN, mxIsComplex
complex*16 x(100), y(100), z(199)
C Check for proper number of arguments.
if (nrhs .ne. 2) then
call mexErrMsgTxt('Two inputs required.')
elseif (nlhs .gt. 1) then
call mexErrMsgTxt('Too many output arguments.')
Vedere la pagina 132
1 2 ... 128 129 130 131 132 133 134 135 136 137 138 ... 407 408

Commenti su questo manuale

Nessun commento