MatData (Scripts) Publisher's description
from Xianyao Chen
where "filename" is the string of .mat file's name, "varname" is the string of variable's name stored in
where "filename" is the string of .mat file's name, "varname" is the string of variable's name stored in .mat file, "var" is the variable's name in Fortran program, which can be any one of the following type: 0~3 dimensions, integer(kind=2) or real(kind=4) variables, or string. Other kind of variables will be supported in future.
"action" is character(len=1), optional variable ('w' or 'a'), which denotes create or append the data file "filename". If the file doesnot exist, it will be created.
Examples to use this module in Fortran 90/95:
If want to output a two-dimensional array Temp(100,200) into matlab data file result.mat, use following code:
When read this data into another variable temp2(100,200), using
Since MATLAB is case-sensitive whereas Fortran is not, "varname" shoule be case-sensitive.
When compile this Fortran program, MATLAB supported .dll and .lib files libmat.dll libmat.lib libmx.dll libmx.lib libut.dll
must be in the bin and lib path, and following command line is requried:
f90 ... matdata.f90 ... libmat.lib libmx.lib
Update, May 25, 2004:
New functions are added into the module, which include read/write one-dimensional matrix of strings.
For example, in order to read/write character(len=100), dimension(100) :: name into result.mat file,
use following code:
call read ('result.mat','name',name)
One thing should be noted: because Fortran and Matlab use different way to store string array, the subroutine to read
the string array from .mat file to Fortran array use an un-efficient algorithm, if anyone has new idea to improve it,
please contact with me. And also, with this algorithm, unicode output is invalid, evenif both Fortran and Matlab support
unicode string. I hope someone can help me to find an efficient algorithm to input/output unicode string to/from .mat file.
Update, Sep. 24, 2004:
New functions are added to the module, which includes:
1) integer(kind=2) and real(kind=8) (double precision)
2) four-dimensions array for all kinds of data type
In order to read .mat file created by Matlab Ver 7, -V6 option should be used, for example: save -mat -V6 [variable lists]
System Requirements:MATLAB 6.5 (R13)
Program Release Status: New Release
Program Install Support: Install and Uninstall