I'm trying to call a user-defined MATLAB function from a C application, but I'm having trouble getting even the simplest engine scenario to work. Below is a program that should simply print a = 1
into the MATLAB command window. But when I run it, nothing happens!
#include "engine.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
int main()
{
Engine *ep;
if (!(ep = engOpen("\0"))) {
fprintf(stderr, "\nCan't start MATLAB engine\n");
return EXIT_FAILURE;
}
engOutputBuffer(ep, NULL, 0);
engEvalString(ep, "a = 1");
engClose(ep);
return EXIT_SUCCESS;
}