Main Content

mexEvalStringWithTrap (C and Fortran)

Execute MATLAB command in caller workspace and capture error information

C Syntax

#include "mex.h"
mxArray *mexEvalStringWithTrap(const char *command);

Fortran Syntax

#include "fintrf.h"
mwPointer mexEvalStringWithTrap(command)
character*(*) command


The mexEvalStringWithTrap function performs the same function as mexEvalString. However, if MATLAB® detects an error when executing command, MATLAB returns control to the line in the MEX file immediately following the call to mexEvalStringWithTrap.

Input Arguments

expand all

Name of the MATLAB command to execute, specified as const char* in C or character*(*) in Fortran. In C, the function supports UTF-8 characters.

Output Arguments

expand all

NULL if no error occurred. Otherwise, returns a pointer specified as mxArray* in C or mwPointer in Fortran of class MException. For information about MException, see Respond to an Exception.

Version History

Introduced before R2006a

expand all