This is machine translation

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

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Code Analysis and Execution

Check code for issues, protect code, and evaluate expressions or functions

Code analysis and execution functions provide options for checking, protecting, and running your code. For example, when you upgrade to a new version of MATLAB®, you can generate a report of potential compatibility issues in your code, such as discouraged or removed functions and the occurrence of invalid syntaxes.


codeCompatibilityReportCreate code compatibility report
analyzeCodeCompatibilityCreate code compatibility analysis results
checkcodeCheck MATLAB code files for possible problems
mlintrptRun checkcode for file or folder
assertThrow error if condition false
runtestsRun set of tests
testsuiteCreate suite of tests
pcodeCreate protected function file
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
timerCreate object to schedule execution of MATLAB commands


Write Test Using Live Script

This example shows how to write a live script that tests a function that you create.

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.

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.

Was this topic helpful?