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

  1. c
  2. c    MATTEST1
  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 writes a simple 3-by-2 real matrix into a MAT-file.
  8. c    The matrix is named, 'A', and the MAT-file is named, 'foo.mat'.
  9. c    
  10.       program main
  11.       integer matOpen, mxCreateFull, matClose, mxGetPr, matPutMatrix
  12.       integer a, fp, stat
  13.       double precision Areal(6)
  14.       data Areal / 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 /
  15. c
  16.       fp = matOpen('foo.mat', 'w')
  17.       a = mxCreateFull(3, 2, 0)
  18.       call mxCopyReal8ToPtr(Areal, mxGetPr(a), 6)
  19.       call mxSetName(a, 'A')
  20.       stat = matPutMatrix(fp, a)
  21.       stat = matClose(fp)
  22.       call mxFreeMatrix(a)
  23. c
  24.       stop
  25.       end
  26.