User`s manual
Examples of Fortran MEX-Files
3-29
C
C NOTE: The subroutine loadsparse() is in the file called
C loadsparse.f.
C This is a MEX-file for MATLAB.
C Copyright (c) 1984-2000 The MathWorks, Inc.
C
C===============================================================
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 64-bit platform
C
integer plhs(*), prhs(*)
integer mxGetPr, mxCreateSparse, mxGetIr, mxGetJc
integer pr, sr, irs, jcs
C---------------------------------------------------------------
C
integer m, n, nzmax
integer mxGetM, mxGetN, mxIsComplex, mxIsDouble
integer loadsparse
C Check for proper number of arguments.
if (nrhs .ne. 1) then
call mexErrMsgTxt('One input argument required.')
endif
if (nlhs .gt. 1) then
call mexErrMsgTxt('Too many output arguments.')
endif
C Check data type of input argument.
if (mxIsDouble(prhs(1)) .eq. 0) then
call mexErrMsgTxt('Input argument must be of type double.')
endif
if (mxIsComplex(prhs(1)) .eq. 1) then
call mexErrMsgTxt('Input argument must be real only')
endif