Transformation struct to array

조회 수: 5 (최근 30일)
Pavel Aksentsev
Pavel Aksentsev 2022년 3월 12일
답변: Walter Roberson 2022년 3월 12일
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