I am converting MATLAB code to C. During that process I need to read some .mat file. Read the .mat file field, save them into array then process it.
I have seen some example here.
Here they have used the MATLAB-provided API. Is there a way to do it in simple C without any API?
I tried with the API according to suggestion with simple code:
#include "mat.h"
void matread_Cell(const char *file, const char *FieldName, int CellIndex)
{
printf("\n From matread_cell Reading matfile %s...\n\n", file);
MATFile* pmat = matOpen(file, "r");
if (pmat == NULL) {
printf("Error opening file %s\n", file);
return;
}
}
Unfortunately, it does not recognize MATFile or matOpen. The error says
undefined reference to `matOpen' Blockquote
I copied the mat.h file from the extern/include/mat.h directory, including matrix.h and tmwtypes.h.