This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

mexEvalString (C)

Execute MATLAB command in caller workspace

C Syntax

#include "mex.h"
int mexEvalString(const char *command);

Description

Note

To write MEX functions using modern C++ features and the MATLAB Data API, see C++ MEX Applications.

Call mexEvalString to invoke a MATLAB® command in the workspace of the caller. The function returns 0 if successful, and 1 if an error occurs.

mexEvalString and mexCallMATLAB both execute MATLAB commands. Use mexCallMATLAB for returning results (left side arguments) back to the MEX function. The mexEvalString function does not return values to the MEX function.

All arguments that appear to the right of an equal sign in the command string must be current variables of the caller workspace. Do not use MATLAB function names for variable names. Common variable names that conflict with function names include i, j, mode, char, size, or path. To determine whether a particular name is associated with a MATLAB function, use the which function. For more information, see Variable Names.

Input Arguments

expand all

Name of the MATLAB command to execute, specified as const char*.

Error Handling

If command detects an error, then MATLAB returns control to the MEX function and mexEvalString returns 1. To trap errors, use the mexEvalStringWithTrap function.

Examples

See these examples in matlabroot/extern/examples/mex:

Introduced before R2006a