User`s manual

3 Creating Fortran MEX-Files
3-20
do 20 i=1,m
do 10 j=1,n
z(i,j)=x*y(i,j)
10 continue
20 continue
return
end
Below is the gateway routine that calls xtimesy, the computation subroutine
that multiplies a scalar by a scalar or matrix.
C--------------------------------------------------------------
C
C xtimesy.f
C
C Multiply the first input by the second input.
C This is a MEX file for MATLAB.
C Copyright (c) 1984-2000 The MathWorks, Inc.
C $Revision: 1.11 $
subroutine mexFunction(nlhs, plhs, nrhs, prhs)
C--------------------------------------------------------------
C (pointer) Replace integer by integer*8 on the DEC Alpha
C platform.
C
integer plhs(*), prhs(*)
integer mxCreateFull
integer x_pr, y_pr, z_pr
C--------------------------------------------------------------
C
integer nlhs, nrhs
integer m, n, size
integer mxGetM, mxGetN, mxIsNumeric
real*8 x, y(3,3), z(3,3)
C Check for proper number of arguments.
if (nrhs .ne. 2) then
call mexErrMsgTxt('Two inputs required.')
elseif (nlhs .ne. 1) then
call mexErrMsgTxt('One output required.')