home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l460 / 2.ddi / SRC.DI$ / MATTEST2.F < prev    next >
Encoding:
Text File  |  1993-03-26  |  661 b   |  25 lines

  1. c
  2. c    MATTEST2
  3. c
  4. c    Simple program that illustrates how to call the MAT-file Library
  5. c    from a Fortran program.  
  6. c
  7. c    The example reads a matrix into a double array.
  8. c    The matrix is named, 'A', and the MAT-file is named, 'foo.mat'.
  9. c
  10.       Program main
  11.       integer mn, stat
  12.       integer fp, a
  13.       double precision Areal(6)
  14.       integer matOpen, matGetMatrix, mxGetM, mxGetn, matClose
  15. c
  16.       fp = matOpen('foo.mat', 'r')
  17.       a = matGetMatrix(fp, 'A')
  18.       mn = mxGetM(a) * mxGetN(a)
  19.       call mxCopyPtrToReal8(mxGetPr(a), Areal, 6)
  20.       stat = matClose(fp)
  21.       call mxFreeMatrix(a)
  22.       write(6,*) 'Row 1: ',Areal(1),' ',Areal(4)
  23.       stop
  24.       end
  25.