## Troubleshoot MuPAD to MATLAB Translation Errors

Note

`convertMuPADNotebook` will be removed in a future release. Convert your MuPAD® notebooks to MATLAB® live scripts now, and use the MATLAB Live Editor instead.

This page helps troubleshoot errors generated by the `convertMuPADNotebook` function when converting MuPAD notebooks to MATLAB live scripts. For the conversion steps, see Convert MuPAD Notebooks to MATLAB Live Scripts. To troubleshoot warnings, see Troubleshoot MuPAD to MATLAB Translation Warnings.

Error MessageDetailsRecommendations
No equivalent code in MATLAB.

`convertMuPADNotebook` cannot find the corresponding functionality in MATLAB.

Adjust the code so that it uses only the functionality that can be expressed in the MATLAB language. Alternatively, in the target `.mlx` file, some functionality can be replaced with MATLAB functionality, such as in statistics or file input-output.

Unable to translate the second and higher derivatives of Airy functions. Express these derivatives in terms of Airy functions and their first derivatives.

The MATLAB `airy` function represents Airy functions of the first and second kind and their first derivatives. In MuPAD, `airyAi(z,n)` and `airyBi(z,n)` can represent second and higher derivatives of Airy functions, that is, `n` can be greater than 1.

Rewrite second and higher derivatives of Airy functions in terms of Airy functions and their first derivatives. Then convert the result to MATLAB code.

The MuPAD `airyAi` and `airyBi` functions return results in terms of Airy functions and their first derivatives. You can replace second and higher derivatives by their outputs in MuPAD, before converting the code to MATLAB.

Unable to translate assignment to MuPAD environment variable.

Environment variables are global variables, such as `HISTORY`, `LEVEL`, `ORDER`, and so on, that affect the behavior of MuPAD algorithms.

In some cases, you can use name-value pair arguments in each function call, such as setting the value `Order` in the `taylor` function call.

In other cases, there is no appropriate replacement. Adjust the code so that it does not require a global setting.

Unable to translate assignments to the remember table of a procedure.

MuPAD uses remember tables to speed up computations, especially when you use recursive procedure calls. The system stores the arguments of a procedure call as indices of the remember table entries, and the corresponding results as values of these entries. When you call a procedure using the same arguments as in previous calls, MuPAD accesses the remember table of that procedure. If the remember table contains the entry with the required arguments, MuPAD returns the value of that entry.

The remember tables created by the option `remember` or `prog::remember` are not available in MATLAB.

Adjust the code so that it does not use remember tables.

Unable to translate assignments to slots of domains and function environments.

In MuPAD, the `slot` function defines methods and entries of data types (domains) or for defining attributes of function environments (domain type `DOM_FUNC_ENV`). These methods and entries (slots) let you overload system functions by your own domains and function environments.

Domains, function environments, and their slots are not available in MATLAB.

Adjust the code so that it does not use assignments to slots of domains and function environments.

Unable to translate explicitly given coefficient ring.

MuPAD lets you use special coefficient rings that cannot be represented by arithmetical expressions. Specifying coefficient rings of polynomials is not available in MATLAB.

Adjust the code so that it does not use polynomials over special rings.

Unable to translate `complexInfinity`.

MuPAD uses the value `complexInfinity`. This value is not available in MATLAB.

Adjust the code so that it does not use `complexInfinity`.

Unable to translate MuPAD code because it uses an obsolete calling syntax.

MuPAD syntax has changed and the code uses obsolete syntax that is no longer supported.

Adjust the code so that it uses only the functionality that can be expressed in the MATLAB language and then run `convertMuPADNotebook` again.

Unable to translate a call to the function 'D' with more than one argument.

The indices in the first argument of `D` cannot be translated to variable names in MATLAB.

Use the MuPAD `diff` function instead of `D`.

Unable to translate MuPAD domains, or commands to create domains or their elements.

Domains represent data types in MuPAD. They are not available in MATLAB.

Adjust the code so that it does not create or explicitly use domains and their elements.

Unable to translate the MuPAD environment variable ''{0}''.

Environment variables are global variables, such as `HISTORY`, `LEVEL`, `ORDER`, and so on, that affect the behavior of MuPAD algorithms.

`convertMuPADNotebook` cannot translate MuPAD environment variables because they are not available in MATLAB.

Adjust the code so that it does not require accessing MuPAD environment variables.

Unable to translate function calls with expression sequences as input arguments.

In MuPAD, a function call `f(x)`, where `x` is a sequence of `n` operands, resolves to a call with `n` arguments.

MATLAB cannot resolve function calls with expression sequences to calls with multiple arguments.

Adjust the code so that it does not contain function calls with expression sequences as input arguments.

Unable to translate infinite sets.

MuPAD recognizes infinite sets. For example, the `solve` function in MuPAD can return a solution as an infinite set: ```solve(sin(x*PI/2) = 0, x)``` returns $\left\{2k|k\in ℤ\right\}$. You can create such sets by using `Dom::ImageSet`.

MATLAB does not support infinite sets.

Adjust the code so that it does not use infinite sets as inputs.

Unable to translate a call accessing previously computed results. The MATLAB `ans` function lets you access only the most recent result.

The MuPAD `last` function and its shortcut `%` typically let you access the last 20 commands stored in an internal MuPAD history table.

In MATLAB, `ans` lets you access only one most recent command.

Adjust the code so that it uses assignments instead of relying on `last` or `%`.

Unable to translate the variable "{0}" representing a MuPAD library.

Libraries contain most of the MuPAD functionality. Each library includes a collection of functions for solving particular types of mathematical problems. While MuPAD library functions are translated to MATLAB code, the libraries themselves are not.

Adjust the code so that it does not use MuPAD library names as identifiers.

Unable to map a function to objects of this class.

Objects of this class do not have an equivalent representation in MATLAB. The mapping cannot be translated.

In the target `.mlx` file, implement the mapping by writing a loop.

Unable to translate this form of matrix definition.

MuPAD provides a few different approaches for creating a matrix. You can create a matrix from an array, list of elements, a nested list of rows, or a table. Also, you can create a matrix by specifying only the nonzero entries, such as `A[i1,j1] = value1`, ```A[i2,j2] = value2```, and so on.

Some of these approaches cannot be translated to MATLAB code.

Adjust the code so that it defines matrices by using an array, list of elements, or a nested list of rows.

Cannot translate division with respect to several variables.

Polynomial division with respect to several variables is not available in MATLAB.

Adjust the code so that it does not use polynomial division with respect to several variables.

Unable to translate nested indexed assignment.

Nested indexed assignment is not available in MATLAB.

Replace the nested indexed assignment with multiple assignments.

Unable to create a polynomial from a coefficient list.

Cannot translate polynomial creation from the given coefficient list.

Make the first argument to `poly` an arithmetical expression instead of a list.

Unable to translate nontrivial procedures.

For code that you want to execute repeatedly, MuPAD lets you create procedures by using the `proc` command.

`convertMuPADNotebook` can translate simple procedures to anonymous functions. Simple procedures do not contain loops, assignments, multiple statements, or nested functions where the inner function accesses variables of the outer function.

More complicated procedures cannot be translated to MATLAB code.

Adjust the code so that it does not use complicated procedures.

Unable to translate the global table of properties.

`convertMuPADNotebook` cannot translate the MuPAD global table of properties, `PROPERTIES`, because this functionality is not available in MATLAB.

Set assumptions as described in Use Assumptions on Symbolic Variables.

Unable to create random generators with individual seed values.

MuPAD lets you set a separate seed value for each random number generator. MATLAB has one seed value for all random number generators. See `rng` for details.

Adjust the code so that it does not rely on individual seed values for different random number generators.

Unable to translate target ''{0}'' for MATLAB function ''rewrite''.

The MuPAD `rewrite` function can rewrite an expression in terms of the following targets: `andor`, `arccos`, `arccosh`, `arccot`, `arccoth`, `arcsin`, `arcsinh`, `arctan`, `arctanh`, `arg`, `bernoulli`, `cos`, `cosh`, `cot`, `coth`, `diff`, `D`, `erf`, `erfc`, `erfi`, `exp`, `fact`, `gamma`, `harmonic`, `heaviside`, `inverf`, `inverfc`, `lambertW`, `ln`, `max`, `min`, `piecewise`, `psi`, `sign`, `sin`, `sincos`, `sinh`, `sinhcosh`, `tan`, `tanh`.

The MATLAB `rewrite` function supports fewer targets: `exp``log``sincos``sin``cos``tan`, `cot``sqrt`, `heaviside`, `asin`, `acos`, `atan`, `acot`, `sinh`, `cosh`, `tanh`, `coth`, `sinhcosh`, `asinh`, `acosh`, `atanh`, `acoth`, `piecewise`.

Adjust the code so that it uses the target options available in MATLAB. If needed, use a sequence of function calls to `rewrite` with different target options.

Unable to translate slots of domains and function environments.

Slots and domains are not available in MATLAB.

Adjust the code so that it does not use slots or domains.

Unable to substitute only one occurrence of a subexpression.

Substituting only one occurrence of a subexpression is not available in MATLAB.

In the target `.mlx` file, break up the expression using the function `children` to get the subexpression, and then substitute for it using the function `subs`.

MuPAD code contains a syntax error, for example, a missing bracket.

Check and correct the MuPAD code that you are translating.

Test environment of MuPAD not available in MATLAB.

The MuPAD test environment is not available in MATLAB.

Adjust the code so that it does not use the MuPAD test environment.

Unknown domain or library "{0}".

Most likely, a custom domain or library is used and cannot be translated.

Check and correct the MuPAD code that you are translating.

The function is not available in MuPAD.

Check and correct the MuPAD code that you are translating.

Unable to translate calls to the function ''{0}''.

The function is a valid MuPAD function, but the function call is invalid. For example, the number of input arguments or types of arguments can be incorrect.

Check and correct the MuPAD code that you are translating.

Unable to translate calls to functions of the library ''{0}''.

The functions of this library are available in MuPAD, but there are no corresponding functions in MATLAB.

Adjust the code so that it does not use the functions of this library.

MuPAD function ''{0}'' cannot be converted to function handle.

The MuPAD function does not have an equivalent function handle in MATLAB.

Adjust the code to use a function that has an equivalent in MATLAB.

Unable to translate option ''{0}''.

Most likely, this option is available in MuPAD, but there are no corresponding options in MATLAB.

Adjust the code so that it does not use this option.

Unable to translate MuPAD code because it uses invalid calling syntax.

Most likely, the function call in the MuPAD code has an error.

Check and correct the MuPAD code that you are translating.