As shown in figure
Under the button code
Engine * ep;//define the Matlab engine pointer,
if (! (ep=engOpen (NULL)))//test whether successful start Matlab engine,
{
MessageBox (" Can 't start Matlab engine!" );
exit(1);
}
EngClose (ep);//close Matlab engine,