home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l460 / 2.ddi / SRC.DI$ / MATTEST3.C < prev    next >
Encoding:
C/C++ Source or Header  |  1993-03-26  |  472 b   |  28 lines

  1. /*
  2.  *    MATTEST3
  3.  *
  4.  *    Simple program that illustrates how to call the MAT-file Library
  5.  *    from a C program.  
  6.  *
  7.  *    The example prints out the row dimensions of all the Matrices in
  8.  *    a MAT-file.
  9.  *    
  10.  */
  11. #include <stdlib.h>
  12. #include <string.h>
  13. #include "mat.h"
  14.  
  15. main()
  16. {
  17.     MATFile *fp;
  18.     Matrix *mp;
  19.  
  20.     fp = matOpen("foo.mat", "r");
  21.     while ((mp = matGetNextMatrix(fp)) != NULL) {
  22.         printf("Row dimension is %d\n",mxGetM(mp));
  23.         mxFreeMatrix(mp);
  24.     }
  25.     matClose(fp);
  26.     exit(0);
  27. }
  28.