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

  1. c
  2. c    MATTEST7
  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 prints out a directory of the Matrix names contained
  8. c    within a MAT-file.
  9. c
  10.       program main
  11.       integer*4 fp, dir, ndir, adir(100), i, stat
  12.       character*20 names(100)
  13.  
  14.       fp = matOpen('foo.mat', 'r')
  15.       dir = matGetDir(fp, ndir)
  16.       stat = matClose(fp)
  17.       if (dir .eq. 0) then
  18.          write(6,*) 'Can''t read directory.'
  19.          stop
  20.       endif
  21.  
  22. c Copy pointer into an array of pointers
  23.       call mxCopyPtrToInteger4(dir, adir, ndir)
  24.  
  25. c Copy pointer to character string
  26.       do 20 i=1,ndir
  27.          call mxCopyPtrToCharacter(adir(i), names(i), 20)
  28.    20 continue
  29.  
  30.       write(6,*) 'Directory of Mat-file:'
  31.       do 30 i=1,ndir
  32.          write(6,*) names(i)
  33.    30 continue
  34.       stop
  35.       end
  36.