Last active
April 2, 2019 14:54
-
-
Save massich/7709ac62edd86047293f01c79f8cf819 to your computer and use it in GitHub Desktop.
libmatio test for homebrew formula
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <matio.h> | |
size_t dims[2] = {5, 5}; | |
double data[25] = {0.0, }; | |
mat_t *mat; | |
matvar_t *matvar; | |
int main(int argc, char **argv) { | |
if (!(mat = Mat_Open(argv[1], MAT_ACC_RDONLY))) | |
abort(); | |
Mat_Close(mat); | |
mat = Mat_CreateVer("test_writenan.mat", NULL, MAT_FT_DEFAULT); | |
if (mat) { | |
matvar = Mat_VarCreate("foo", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, | |
dims, data, MAT_F_DONT_COPY_DATA); | |
Mat_VarWrite(mat, matvar, MAT_COMPRESSION_NONE); | |
Mat_VarFree(matvar); | |
Mat_Close(mat); | |
} else { | |
abort(); | |
} | |
mat = Mat_CreateVer("foo", NULL, MAT_FT_MAT73); | |
return EXIT_SUCCESS; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment