How to convert a sym array into a string array?

13 次查看(过去 30 天)
I have very long arrays of symbolic variables which I need to convert to cell arrays of strings: For example, turning this:
syms x y u
q = [x y u]
into this:
qs = {'x' 'y' 'u'}
something like num2string() but with syms? I'd appreciate any help, thanks.

采纳的回答

Walter Roberson
Walter Roberson 2017-7-23
qc = arrayfun(@char, q, 'uniform', 0);
  4 个评论
Walter Roberson
Walter Roberson 2021-6-2
syms x y u
q = [x y u]
q = 
cellstr(string(q))
ans = 1×3 cell array
{'x'} {'y'} {'u'}

请先登录,再进行评论。

更多回答(0 个)

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by