Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Read a .mat file without the use of matlab API



  • My task is the following:

    I want to read a .mat file, to extract the values of certain variables and plot them on a graph.

    I do not want to use any matlab libraries.

    I am using Qt Creator and programming in C++.

    The file format of the .mat Version 4 file ( the one I want to read ) is available on :

    http://maxwell.me.gu.edu.au/spl/matlab-page/matfile_format.pdf

    A .mat file stores data in binary format. It may contain one or more metrices.

    Anyone who has done something like this succesfully?
    I have experimented alot with streams, qbytearray qfile etc but haven't solved it yet.

    Appreciate the help.



  • I never used matlab API, but into debian repository I see libmatio that could help you.
    The description says:
    "matio is an ISO C library (with a limited Fortran 90 interface) for
    reading and writing Matlab MAT files."

    this is the "link":http://sourceforge.net/projects/matio/ to the project

    regards



  • Hello Deimos,

    While searching for a similar solution, I came across your reply. Just wanted to
    warn that the 'matio' library does not support Matlab level 4 files too well.
    I just tried it out with a simple file I have, a it just didn't work.

    I contacted the author and he indicated he'd rather drop level 4 support (admittedly
    a little old), than patch it up to get it working.

    John


Log in to reply