I tried some combinations with print
, expr2text
, hold
and _concat
but couldn't find a convincing solution to get the desired result. But there is an explanation why the second line just returns z
and not 10
.
Assignment vs. Equation
z
is the result in the second line because you didn't assign something to z
yet. So the result says that z
is z
. In MuPad =
is part of an expression. The assignment operator is :=
and therefore not the same as in Matlab. The only difference between them is the colon.
Writing an equation
For writing an equation, we use =
as part of the expression. There is an equivalent function: _equal
. So the following two lines generate the same result:
x+y = 2
_equal(x+y, 2)

Assign value
to x
For an assignment we use :=
(in Matlab this would be only =
). There is an equivalent function: _assign
. So again, the following two lines generate the same result:
x := value
_assign(x, value)

Assign the equation x+y = 2
to eqn
Here we can clearly see the difference:
eqn := x+y = 2
_assign(eqn, _equal(x+y, 2))
