MATLAB: How to retrieve numbers from symbol

retrieve numbersymbolic

Hi all,
Suppose I have defined
syms x1 x2 x45;
I want to detect and retrieve the numbers 1, 2, 45 from x1, x2, x45. Is that possible in matlab?
Thank you.

Best Answer

syms x1 x2 x45;
str2double(regexp(char(x45),'\d','match'))
Related Question