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.

Programming Utilities

Evaluate expressions or functions indirectly, obfuscate code, set timers, handle exceptions

MATLAB® includes functionality to indirectly evaluate expressions, protect your source code using obfuscation, set timers for program execution, and capture data on errors.

Functions

expand all

evalExecute MATLAB expression in text
evalcEvaluate MATLAB expression with capture
evalinExecute MATLAB expression in specified workspace
fevalEvaluate function
runRun MATLAB script
builtinExecute built-in function from overloaded method
pcodeCreate protected function file
timerCreate object to schedule execution of MATLAB commands
deleteRemove timer object from memory
getQuery property values for timer object
isvalidDetermine timer object validity
setSet property values for timer object
startStart timer object
startatSchedule timer to fire at specified time
stopStop timer object
timerfindFind timer object
timerfindallFind timer object, regardless of visibility
waitBlock command prompt until timer stops running
try, catchExecute statements and catch resulting errors
MExceptionCapture error information
addCauseRecord additional causes of exception
addCorrectionProvide suggested fix for exception
getReportGet error message for exception
MException.lastReturn last uncaught exception
rethrowRethrow previously caught exception
throwThrow exception
throwAsCallerThrow exception as if occurs within calling function
matlab.lang.correction.AppendArgumentsCorrectionCorrect error by appending missing input arguments

Topics

Protect Your Source Code

When you share your MATLAB code, the contents are easily accessed, revealing design and implementation details. You can obfuscate or compile your source files.

Schedule Command Execution Using Timer

To schedule the execution of MATLAB commands, create a timer object.

Exception Handling in a MATLAB Application

It is a good programming practice to include error checking in your programs to ensure reliable operation under all conditions. You can decide how your programs respond to different types of errors.

Create Hyperlinks that Run Functions

Functions that support the matlab: keyword can display hyperlinks, which execute commands when you click the hyperlink text.

Alternatives to the eval Function

Although the eval function is very powerful and flexible, it is not always the best solution to a programming problem. In many instances, there are recommended alternative approaches to using eval.