Hi 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 matlab provided api. Is there any way to do it in simple C without any api?
Update: I just tried with 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 from extern/include/mat.h directory,including matrix.h and tmwtypes.h.