Post date: Aug 07, 2015 6:13:56 AM
MatIO is a C library that allows the management of mat files used in MatLab. The library is available from http://sourceforge.net/projects/matio/
I run a Windows 7 development system running VS2013 and this is how I managed the first time I got it running.
Download source code from the above link. Extract the zip file and read the README file.
To compile MatIO, 2 prerequisites are needed.
HDF5 and zlib.
At this point it would be good to decide whether you want a 32-bit or 64-bit target.
Download the required HDF5 and the zlib packages.
HDF5 has a msi installer and will install it on your system in either Program Files (x86) for 32 bit systems and Program Files for 64 bit systems.
Unzip the zlib package into a directory so VS can access it. No installation is required here.
After successful installation, define an environment variable HDF5_DIR on your PC that points to the root directory of HDF5..
Open your Visual Studio IDE and go to visual_studio directory in the MatIO unzipped package.
Open the VS project file and depending on the version of your VS, VS will prompt you to update the MatIO VS project file.
After conversion, go to the Project Properties form and check that
1. $(HDF5_DIR)\include is in Additional Include Directories and points to the right place,
2. $(HDF5_DIR)\lib is in Additional Library Directories and points to the right place
3. Additional Dependencies have hdf5.lib, szip.lib and zlib.lib
I found that I needed to change the original entries that came with the package to those listed in 1 to 3 above.
Debug if necessary and just run Build Solution or Build libmatio in VS. Take note that the compiled files are in a directory named Release.
Close the MatIO project.
Open a new project which will use the MatIO.
In this new project's Properties, ensure that
1. Additional Include Directories point to matio-1.5.2\src and matio-1.5.2\visual_studio
2. Additional Library Directories point to matio-1.5.2\visual_studio\Release
3. Add libmatio.lib to the Additional Dependencies
Create a .cpp source to run, call it say HelloMatIO.cpp
For code, I copied from the user guide available at http://sourceforge.net/projects/matio/files/matio/1.5.2/
The file is attached.
Now build the new project.
After successfully building the project, copy libmatio.dll from the Release directory in #2 above to the Output Directory.
Running the new project works after this.