MATLAB: Get only addends of subexpression

children

Suppose I have a symbolic expression like this
syms x x0
f=(x-x0)^3
children(f)
[(x-x0),3]
I would like to get instead
[(x-x0)^3]
How can this be done?

Best Answer

You cannot do that with children().
You need to do something like,
feval(symengine, '(V) -> if testtype(V,"_plus") then [op(V)] else [V] end_if;', f)