Quit a MATLAB engine session
C Syntax
#include "engine.h"
int engClose(Engine *ep);
Arguments
ep
Engine pointer.
Description
This routine allows you to quit a MATLAB engine session.
engClose
sends a quit command to the MATLAB engine session and closes the connection. It returns 0 on success, and 1 otherwise. Possible failure includes attempting to terminate a MATLAB engine session that was already terminated.
Examples
For UNIX:
/
* engtest2.c
*/
#include <stdio.h>
#include <stdlib.h>
#include "engine.h"
void main()
{
ep = engOpen("");
if (ep == NULL) {
fprintf(stderr, "Unable to start MATLAB session\n");
exit(EXIT_FAILURE);
}
void engClose(ep);
exit(EXIT_SUCCESS);
}
For Windows:
/*ENGTEST2*/
#include <stdlib.h>
#include <stdio.h>
#include "engine.h"
int WINAPI WinMain(HANDLE hInstance,
HANDLE hPrevInstance,
LPSTR lpszCmdLine,
int nCmdShow)
{
Engine *ep;
if (!(ep = engOpen())) {
MessageBox ((HWND)NULL,
(LPSTR)"Can't start MATLAB engine",
(LPSTR) "Engtest2.c", MB_OK);
}
engClose(ep);
return (TRUE);
}
See engdemo.c
in the eng_mat
subdirectory of the examples
directory for a sample program that illustrates how to call the MATLAB engine functions from a C program.
[ Previous | Help Desk | Next ]