Migrate MuPAD® notebooks to MATLAB® live scripts that use MATLAB code. Live scripts are an interactive way to run MATLAB code. For details, see What Is a Live Script or Function? (MATLAB) MuPAD notebooks are converted to live scripts by using Symbolic Math Toolbox™. For more information, see Getting Started with Symbolic Math Toolbox.
.mnto a MATLAB Live Script
Prepare the notebook: This step is optional, but helps avoid conversion errors and warnings. Check if your notebook contains untranslatable objects from MuPAD Objects That Are Not Converted. These objects cause translation errors or warnings.
Convert the notebook: Use
convertMuPADNotebook. For example, convert
the current folder to
myScript.mlx in the same
Alternatively, right-click the notebook in the Current Folder browser and select Open as Live Script.
Check for errors or warnings: Check
the output of
convertMuPADNotebook for errors
or warnings. If there are none, go to step 7. For example, this output
means that the converted live script
Created ''myScript.mlx': 4 translation errors, 1 warnings. For verifying... the document, see help.
A translation error means that the translated code will not run correctly while a translation warning indicates that the code requires inspection. If the code only contains warnings, it will likely run without issues.
Fix translation errors: Open the converted live
script by clicking the link in the output. Find errors by searching for
ERROR. The error explains which MuPAD command did not translate correctly. For details and fixes, click
ERROR. After fixing the error, delete the error message. For the
list of translation errors, see Troubleshoot MuPAD to MATLAB Translation Errors. If you cannot fix
your error, and the Known Issues do not help, please contact technical
Fix translation warnings: Find
warnings by searching for
WARNING. The warning
text explains the issue. For details and fixes, click
Decide to either adapt the code or ignore the warning. Then delete
the warning message. For the list of translation warnings, see Troubleshoot MuPAD to MATLAB Translation Warnings.
Verify the live script: Open the live script and check for unexpected commands, comments, formatting, and so on. For readability, the converted code may require manual cleanup, such as eliminating auxiliary variables.
Execute the live script: Ensure that the code runs properly and returns expected results. If the results are not expected, check your MuPAD code for the Known Issues listed below.
To convert MuPAD graphics, first try to convert the MuPAD plot commands that generated the graphics. This approach ensures you can control the graphical output in MATLAB similar to MuPAD. If you cannot convert the MuPAD commands, then export the graphic. See Save and Export Graphics.
Expand the list to view MuPAD objects that are not converted. To avoid conversion errors and warnings, remove these objects or commands from your notebook before conversion.
In MATLAB, when symbolic variables are assigned values, then expressions containing those values are not automatically updated.
last(1)in MuPAD Is Not
last(1) always returns the
last result. In MATLAB,
ans returns the result
of the last unassigned command. For example,
in MATLAB if you run
x = 1, then calling
solveResults Are Wrongly Accessed
When results of MuPAD
solve are accessed,
that the result is a finite set. However, if the result is a non-finite
set then the code is wrongly translated.
caseIs Wrongly Translated
In MuPAD, a
break ends a case in a switch
case. However, MATLAB does not require a
end a case. Thus, a MuPAD
break in MATLAB. Also, if a MuPAD case
break, then the MATLAB case will not
While the most commonly used MuPAD graphics options are translated, there are some options that are not translated.
Operations on matrices are not always translated correctly.
For example, if
M is a matrix, then
exp(M) in MuPAD is
wrongly translated to
exp(M) instead of the matrix
indetsBehavior in MATLAB Differs
indets is translated to MATLAB
not find bound variables or constant identifiers like
factorDiffers in MATLAB
The return type of MuPAD
no equivalent in MATLAB. Subsequent operations on the results
factor in MATLAB might return incorrect
MuPAD notebook frames are not converted.
MuPAD notebook tables are not converted.
MuPAD plots are not interactive in live scripts.
Titles or headings in MuPAD notebooks are not always detected.
MuPAD text attribute
Text formatting: Font, font size, and color are not converted. All text in live scripts looks the same.
For the syntax differences between MATLAB and MuPAD, see Differences Between MATLAB and MuPAD Syntax.