represent symbolic toolbox as a string

1 次查看(过去 30 天)
I am using the symbolic toolbox in Array1. How do you represent it as a string?
syms r,theta,phi
x=r*cos(theta)*cos(phi)
y=r*sin(theta)*cos(phi)
z=r*sin(phi)
Array1=num2str([x y z])

回答(1 个)

sixwwwwww
sixwwwwww 2013-12-6
try this:
syms r theta phi
x=r*cos(theta)*cos(phi)
y=r*sin(theta)*cos(phi)
z=r*sin(phi)
Array1 = char([x y z])
  5 个评论
sixwwwwww
sixwwwwww 2013-12-6
you can do it as follow:
syms r theta phi
x = r * cos(theta) * cos(phi);
y = r * sin(theta) * cos(phi);
z = r * sin(phi);
Array1 = {char(x), char(y), char(z)};
% Print string on command window
for i = 1:3
fprintf('String number %d is: %s\n', i, Array1{i})
end
Walter Roberson
Walter Roberson 2013-12-11
Change
Array2(n)=char(Array1(i,j,k,l))
to
Array2{n}=char(Array1(i,j,k,l))

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Assumptions 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by