User`s manual

Examples of MAT-Files
6-21
Creating a MAT-File in Fortran
This example creates a MAT-file, matdemo.mat.
C $Revision: 1.6 $
C
C matdemo1.f
C
C This is a simple program that illustrates how to call the
C MATLAB MAT-file functions from a Fortran program. This
C demonstration focuses on writing MAT-files.
C
C Copyright (c) 1984-2000 The MathWorks, Inc.
C
C
C
C matdemo1 - Create a new MAT-file from scratch.
C
program matdemo1
C--------------------------------------------------------------
C (integer) Replace integer by integer*8 on the DEC Alpha
C platform.
C
integer matOpen, mxCreateFull, mxCreateString
integer matGetMatrix, mxGetPr
integer mp, pa1, pa2, pa3
C--------------------------------------------------------------
C
C Other variable declarations here
C
integer status, matClose
double precision dat(9)
data dat / 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 /
C
C Open MAT-file for writing.
C
write(6,*) 'Creating MAT-file matdemo.mat ...'
mp = matOpen('matdemo.mat', 'w')