MATLAB: Removing exponents from a sysm class term

mupadSymbolic Math Toolboxsyms

I am interested in removing the exponents from a syms class object. For instance, i wish the following expression,
answer = x^2 + y^2*z^2
to instead take the form of,
answer = x + y*z
I was wondering if there was a shorter way to do this other than writing my own muPad procedure.
Thanks in advance.
Ross Montgomery

Best Answer

You can use evalin to do a substitution of the powers inside MuPAD:
>> evalin(symengine, ['subs(', char(answer) ,', hold(_power) = (x->x), EvalChanges)'])
ans =
x + y*z