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