Convert MuPAD Notebooks to MATLAB Live Scripts
convertMuPADNotebook will be removed in a
future release. Convert your MuPAD® notebooks to MATLAB® live scripts now, and use the MATLAB Live Editor instead.
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?. MuPAD notebooks are converted to live scripts by using Symbolic Math Toolbox™. For more information, see Get Started with Symbolic Math Toolbox.
Convert a MuPAD Notebook
.mn to 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
myNotebook.mnin the current folder to
myScript.mlxin the same folder.
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
convertMuPADNotebookfor 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 MathWorks Technical Support.
Fix translation warnings: Find warnings by searching for
WARNING. The warning text explains the issue. For details and fixes, click
WARNING. 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.
Convert MuPAD Graphics to MATLAB Graphics
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 that produce graphics, then you can export the graphics into vector or bitmap formats.
MuPAD Objects That Are Not Converted
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.
No Automatic Substitution in MATLAB
In MATLAB, when symbolic variables are assigned values, then expressions containing those values are not automatically updated.
last(1) in MuPAD Is Not
ans in MATLAB
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
does not return
solve Results 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.
case Is Wrongly Translated
In MuPAD, a
break ends a case in a switch case. However,
MATLAB does not require a
break to end a case. Thus, a
break introduces an unnecessary
break in MATLAB. Also, if a MuPAD case omits a
break, then the MATLAB case will not fall-through.
Some MuPAD Graphics Options Are Not Translated
While the most commonly used MuPAD graphics options are translated, there are some options that are not translated.
Some Operations on Matrices Are Wrongly 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
indets Behavior in MATLAB Differs
indets is translated to MATLAB
does not find bound variables or constant identifiers like
Return Type of
factor Differs in MATLAB
The return type of MuPAD
factor has no equivalent in MATLAB. Subsequent operations on the results of
MATLAB might return incorrect results.
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
underlineis not converted
Text formatting: Font, font size, and color are not converted. All text in live scripts looks the same.
Syntax Differences Between MATLAB and MuPAD
For the syntax differences between MATLAB and MuPAD, see Differences Between MATLAB and MuPAD Syntax.