| Products & Services | Industries | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → MATLAB |
| Contents | Index |
| Learn more about MATLAB |
#include "engine.h" int engEvalString(Engine *ep,const char *string);
integer*4 engEvalString(ep, string) mwPointer ep character*(*) string
0 if the command was evaluated by the MATLAB engine session, and a nonzero value if unsuccessful. Possible reasons for failure include the engine session is no longer running or the engine pointer is invalid or NULL.
If string detects an error, MATLAB terminates and returns control to the MATLAB prompt.
engEvalString evaluates the expression contained in string for the MATLAB engine session, ep, previously started by engOpen.
On UNIX® systems, engEvalString sends commands to the MATLAB workspace by writing down a pipe connected to the MATLAB stdin process. Any output resulting from the command that ordinarily appears on the screen is read back from stdout into the buffer defined by engOutputBuffer.
To turn off output buffering in C, use:
engOutputBuffer(ep, NULL, 0);
To turn off output buffering in Fortran, use:
engOutputBuffer(ep, '')
On a Windows system, engEvalString communicates with MATLAB software using a Component Object Model (COM) interface.
See engdemo.c in the matlabroot/extern/examples/eng_mat folder for sample programs that illustrate how to call the engine functions from a C program.
See engwindemo.c in the matlabroot/extern/examples/eng_mat folder for sample programs that illustrate how to call the engine functions from a C program for Windows systems.
See fengdemo.F in the matlabroot/extern/examples/eng_mat folder for sample programs that illustrate how to call the engine functions from a Fortran program.
[1] UNIX is a registered trademark of The Open Group in the United States and other countries.
![]() | engClose (C and Fortran) | engGetVariable (C and Fortran) | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |