Skip to Main Content Skip to Search
Product Documentation

engEvalString (C and Fortran) - Evaluate expression in string

C Syntax

#include "engine.h"
int engEvalString(Engine *ep, const char *string);

Fortran Syntax

integer*4 engEvalString(ep, string)
mwPointer ep
character*(*) string

Arguments

ep

Engine pointer

string

String to execute

Returns

0 if the MATLAB engine session evaluated the command, and 1 if an error occurs. Possible reasons for failure include the engine session is no longer running or the engine pointer is invalid or NULL.

Error Handling

If string detects an error, MATLAB returns control to the to the MEX-file and engEvalString returns 1.

Description

engEvalString evaluates the expression contained in string for the MATLAB engine session, ep, previously started by engOpen.

UNIX Operating Systems

On UNIX systems, engEvalString sends commands to the MATLAB workspace by writing down a pipe connected to the MATLAB stdin process. MATLAB reads back from stdout any output resulting from the command that ordinarily appears on the screen, 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, '')

Microsoft Windows Operating Systems

On a Windows system, engEvalString communicates with MATLAB software using a Component Object Model (COM) interface.

Examples

See the following examples in matlabroot/extern/examples/eng_mat.

See Also

engOpen, engOutputBuffer

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS