Transformation struct to array

5 次查看(过去 30 天)
HI, why is it not work?
xdata=[1];
n=3;
subs(eqn,y,n);
st=solve(eqn,x);
xdata(n)=struct2cell(st);
Error:
Check for missing argument or incorrect argument data type in call to function 'struct2cell'.
  1 个评论
AndresVar
AndresVar 2022-3-12
编辑:AndresVar 2022-3-12
if you look at documentation for solve it says the output is a symbolic array.
struct2cell input is struct not symbolic array

请先登录,再进行评论。

采纳的回答

Walter Roberson
Walter Roberson 2022-3-12
solve returns a struct only if you are solving for more than one variable and the number of outputs does not match the number of variables (though 'returnconditions' may affect this)
You are solving for a single variable without returnconditions so you will get a symbolic output not a struct

更多回答(0 个)

类别

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

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by