Skip to content

ker264/i_mat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

i_mat

Library for reading mat files into gsl structures and standard types of C data

Dependencies

  • zlip - mingw64/mingw-w64-x86_64-zlib 1.2.13-3 Compression library implementing the deflate compression method found in gzip and PKZIP (mingw-w64)
  • gsl - GNU Sciencific Library 2.7

Requirements for mat file

  • One parameter per one mat file
  • Works with matrices of size AxB

Types of data that the library works with

gsl type matlab type
double double
int int
complex double complex double
gsl_vector double vector
gsl_vector_int int vector
gsl_vector_complex complex double vector
gsl_matrix double matrix
gsl_matrix_int int matrix
gsl_matrix_complex complex double matrix

Library does not work with cell structures

Example of work

#include "i_mat.h"

int main(int argc, char const *argv[])
{
    IMatError mError;

    // vector
    gsl_vector *S_test = openMatVector("S.mat", &mError);
    if (mError.isErr)
    {
        printf("\nS_test: %s", mError.stringErr);
    }
    else
    {
        printf("\nS_test: %d элементов", S_test->size);
    }

    // int
    int a = openMatInt("k.mat", &mError);
    if (mError.isErr)
    {
        printf("\na: %s", mError.stringErr);
    }
    else
    {
        printf("\na: %d", a);
    }
}