-
-
Notifications
You must be signed in to change notification settings - Fork 99
/
README
255 lines (228 loc) · 12.9 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
MATIO - MATLAB MAT file I/O library
Table of Contents
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1.0 Introduction
1.1 Contact
1.2 Acknowledgements
1.3 Contributing
1.4 Questions and Reporting Bugs
2.0 Building
2.1 Dependencies
2.1.1 zlib
2.1.2 HDF5
2.2 Building matio
2.2.1 Quick Build Guide
2.2.2 Configure Options
2.2.3 CMake build system
2.2.4 Visual Studio
2.2.5 Testsuite
2.3 Platforms
3.0 License
1.0 Introduction
Matio is an open-source C library for reading and writing binary MATLAB MAT
files.
This library is designed for use by programs/libraries that do not have
access or do not want to rely on MATLAB's shared libraries.
1.1 Contact
You can contact the maintainer through email at
1.2 Acknowledgements
The following people/organizations have helped in the development of
matio through patches, bug reports, and/or testing:
* Don Zimmer (https://github.com/dpzimmer)
* Greg Sjaardema (https://github.com/gsjaardema)
* Jacco van Beek (https://sourceforge.net/u/jabe)
* John Filo (https://github.com/jfilo)
* LTX Simulation (https://www.ltx.de/english.html)
* Maarten Bent (https://github.com/MaartenBent)
* Modelica Association (https://modelica.org/association)
* Nelson (https://nelson-lang.github.io/nelson-website/)
* Nils Jannasch (https://github.com/NJannasch)
* OpenMEEG ((http://openmeeg.github.io/)
* Scilab (http://www.scilab.org/)
* Sébastien Villemot (https://github.com/svillemot)
* SGI in support of Interactive Supercomputing, Inc.
* Steven Leibman <[email protected]>
1.3 Contributing
If you are interested in collaborations, contact the maintainer via
email (see section 1.1).
1.4 Questions and Reporting Bugs
Questions can be asked using the forums on the sourceforge site hosting
matio (https://sourceforge.net/p/matio/discussion).
Bugs, enhancements, etc. should be submitted using one of the trackers
on the sourceforge page (https://sourceforge.net/p/matio/_list/tickets).
2.0 Building
This section describes how to build matio. Section 2.1 describes the
dependencies, section 2.2 how to build/test matio, and section 2.3
documents the platforms matio has been tested on.
2.1 Dependencies
Matio has two optional dependencies. These are not required for the
software to work, but without them some files may be unreadable. Zlib
is required to read/write level 5 MAT files that use compression. HDF5
is required to work with newer MAT files that use the HDF5-format
files.
2.1.1 zlib
To support compressed MAT files, zlib 1.2.3 or greater is required.
The zlib software can be downloaded from http://zlib.net.
2.1.2 HDF5
Support for MAT file version 7.3 requires the HDF5 library. This
library can be downloaded from https://www.hdfgroup.org/. Matio
requires HDF5 version 1.8.x or greater. Neither deprecated HDF5
1.6.x API functions nor HDF5 higher-level functions are called.
* Building matio with HDF5 1.8.x requires configuration of HDF5
with default API version 1.8 (i.e.
'--with-default-api-version=v18').
* Building matio with HDF5 1.10.x requires configuration of HDF5
with either default API version 1.10 (i.e.
'--with-default-api-version=v110') or with deprecated API
version 1.8 (i.e. '--with-default-api-version=v18').
* Building matio with HDF5 1.12.x requires configuration of HDF5
with either default API version 1.12 (i.e.
'--with-default-api-version=v112'), or with deprecated API
version 1.10 (i.e. '--with-default-api-version=v110') or with
deprecated API version 1.8 (i.e. '--with-default-api-version=v18').
* Building matio with HDF5 1.14.x requires configuration of HDF5
with either default API version 1.14 (i.e.
'--with-default-api-version=v114'), or with deprecated API
version 1.12 (i.e. '--with-default-api-version=v112'), or with
deprecated API version 1.10 (i.e. '--with-default-api-version=v110')
or with deprecated API version 1.8 (i.e.
'--with-default-api-version=v18').
For Windows, the pre-compiled binaries can be used which also
include a DLL of zlib to satisfy the zlib dependency.
For Ubuntu, 'sudo apt install libhdf5-dev' should work fine.
2.2 Building matio
2.2.1 Quick Build Guide
The primary method for building the software is with is with GNU
autotools using 'configure' followed by 'make'. After building, the
testsuite can be executed to test the software using 'make check'.
The software can be installed using 'make install'. For example,
$ tar zxf matio-X.Y.Z.tar.gz
$ cd matio-X.Y.Z
$ ./configure
$ make
$ make check
$ make install
If any of the tests in the testsuite fail, you should report the failure
using the tracker (see section 1.4). You should attach the generated
testsuite.log file to the bug report.
2.2.2 Configure Options
The configure script used to build the software takes a number of
options. This section describes the key options.
* '--enable-mat73=yes'
This flag en/disables the support for version 7.3 MAT files.
The option only makes sense if built with HDF5 as support for
version 7.3 files. It will be disabled if HDF5 is not available.
* '--enable-extended-sparse=yes'
Enable extended sparse matrix data types not supported in
MATLAB. MATLAB only supports double-precision sparse data.
With this flag, matio will read sparse data with other types
(i.e. single-precision and integer types).
* '--with-matlab=DIR'
This option specifies the directory (DIR) with the 'matlab'
program. With this option, the testsuite will check that the
MAT files written by matio can be read into MATLAB. Without
this, the test will only check that matio can read the file
written and if successful the test will be skipped. If matio
can not read the file, the test will fail.
* '--with-zlib=DIR'
This option specifies the prefix where zlib is installed
(see section 2.1.1 for information about zlib).
* '--with-hdf5=DIR'
This option specifies the prefix where the HDF5 software is
installed (see section 2.1.2 for information about HDF5).
* '--with-default-file-ver=version'
This option sets the default MAT file version (4,5,7.3) that
will be used when writing. The default file version is used
by the Mat_Create macro and the Mat_CreateVer function when
MAT_FT_DEFAULT is used for the version argument.
* '--with-libdir-suffix=suffix'
This option specifies a suffix to apply to library
directories when installing and looking for dependent
libraries (i.e. HDF5 and zlib). For example, some multi-arch
Linux distributions install 64-bit libraries into lib64 and
32-bit libraries into lib.
2.3.3. CMake build system
The CMake build system is supported as an alternative build system,
which usually consists of three steps for configuration, build and
installation. By default, the CMake project is also configured for
testing with CTest. For example,
$ tar zxf matio-X.Y.Z.tar.gz
$ cd matio-X.Y.Z
$ cmake .
$ cmake --build .
$ ctest --test-dir .
$ cmake --install .
The following matio specific options for building with CMake are
available.
* 'MATIO_USE_CONAN:BOOL=OFF'
This option enables the Conan package manager to resolve the
library dependencies. Only Conan 1.x is supported.
* 'MATIO_DEFAULT_FILE_VERSION:STRING=5'
This option sets the default MAT file version (4,5,7.3) that
will be used when writing.
* 'MATIO_EXTENDED_SPARSE:BOOL=ON'
This option enables extended sparse matrix data types not
supported in MATLAB.
* 'MATIO_MAT73:BOOL=ON'
This flag enables the support for version 7.3 MAT files.
* 'MATIO_PIC:BOOL=ON'
This option enables position-independent code (PIC),
i.e., compilation with the '-fPIC' flag. It is ignored for
Visual Studio builds.
* 'MATIO_SHARED:BOOL=ON'
This option builds the matio library as shared object
(i.e., a dynamic link library on Windows).
* 'MATIO_WITH_HDF5:BOOL=ON'
This option enables CMake to check for availability of the
HDF5 library (see section 2.1.2 for information about HDF5).
* 'MATIO_WITH_ZLIB:BOOL=ON'
This option enables CMake to check for availability of the
zlib library (see section 2.1.1 for information about zlib).
* 'MATIO_BUILD_TESTING:BOOL=ON'
This option enables the matio testsuite for CTest.
* 'MATIO_ENABLE_CPPCHECK:BOOL=OFF'
This option enables CMake >= 3.10 to perform static analysis
with Cppcheck.
To help CMake find the HDF5 libraries, set environment variable
HDF5_DIR to the 'cmake/hdf5' directory (containing 'hdf5-config.cmake')
inside the HDF5 build or installation directory, or call cmake with
-DHDF5_DIR="dir/to/hdf5/cmake/hdf5". Alternatively call CMake with
-DCMAKE_PREFIX_PATH="dir/to/hdf5/cmake". See the HDF5 instructions
(https://support.hdfgroup.org/HDF5/release/cmakebuild.html#compile)
for more information. Using 'hdf5-config.cmake' is recommended over
using CMake's built-in 'FindHDF5', especially for static builds.
CMake 3.10 or later is recommended.
2.2.4 Visual Studio
Visual Studio solutions are provided as visual_studio/matio_vs2008.sln
for VS2008 and as visual_studio/matio.sln for VS2010 (and newer).
The Debug and Release configurations of both solutions are set up to
build a DLL of the matio library (libmatio.dll) and the matdump tool
and assume HDF5 is available in the directory specified by the
HDF5_DIR environment variable. It is assumed that the shared libraries
of HDF5 (and zlib) are available. If the static libraries of HDF5 (and
zlib) are installed/built the macro 'H5_BUILT_AS_STATIC_LIB' needs to
be defined (instead of 'H5_BUILT_AS_DYNAMIC_LIB'). Furthermore, the
Release Lib configuration of the VS2010 solution is set up to build a
static LIB of the matio library (libmatio.lib) and assumes that the
static libraries of HDF5 (and zlib) are installed/built.
2.2.5 Testsuite
A testsuite is available when building with the GNU autotools. To
run the testsuite, first configure and build matio. After building
run 'make check' to run the testsuite. If matio was built without
zlib, the compressed variable tests will be skipped. If built
without HDF5, the tests for version 7.3 MAT files will be skipped.
If the path to the MATLAB application was not specified
('--with-matlab'), the write tests will fail if matio cannot read
the file and skip if matio can read the file. The write tests will
pass if MATLAB is available and can also read the file.
To report matio testsuite failures, compress the testsuite.log file
in the test sub-directory of the build directory. Upload the
compressed log file along with a bug report (see section 1.4 for
information on reporting bugs).
2.3 Platforms
The library has been tested/used on Linux, Windows, and OS X
including both little-endian and big-endian architecture.
3.0 License
This software is provided under a Simplified BSD license. See the COPYING
file for details on the license.