C $Revision: 1.7 $ C======================================================================= C C dblmat.f C example for illustrating how to use %val C doubles the input matrix. The demo only handles real part of input. C NOTE: if your FORTRAN compiler does not support %val, C use mxCopy_routine. C C This is a MEX-file for MATLAB. C Copyright (c) 1984-98 by The MathWorks, Inc. C======================================================================= C computational subroutine subroutine dbl_mat(out_mat, in_mat, size) integer size, i real*8 out_mat(*), in_mat(*) do 10 i=1,size out_mat(i) = 2*in_mat(i) 10 continue return end C gateway subroutine subroutine mexfunction(nlhs, plhs, nrhs, prhs) C----------------------------------------------------------------------- C (integer) Replace integer by integer*8 on the DEC Alpha and the C SGI 64-bit platforms C integer plhs(*), prhs(*) integer pr_in, pr_out integer mxGetPr, mxCreateFull C----------------------------------------------------------------------- C integer nlhs, nrhs, mxGetM, mxGetN integer m_in, n_in, size if(nrhs .ne. 1) then call mexErrMsgTxt('One input required.') endif if(nlhs .gt. 1) then call mexErrMsgTxt('Less than one output required.') endif m_in = mxGetM(prhs(1)) n_in = mxGetN(prhs(1)) size = m_in * n_in pr_in = mxGetPr(prhs(1)) plhs(1) = mxCreateFull(m_in, n_in, 0) pr_out = mxGetPr(plhs(1)) C call the computational routine call dbl_mat(%val(pr_out), %val(pr_in), size) return end