Struct contents reference from a non-struct array object.

12 ビュー (過去 30 日間)
Eugen Gamentzy
Eugen Gamentzy 2018 年 3 月 31 日
コメント済み: Eugen Gamentzy 2018 年 4 月 1 日
I need to make a function that showes me the state space model for a circuit and i need to overlap the simulink graph to the workspace one. I used this:
t=0:0.1:15;
u=(t>=0);
c=1;
L=1;
R=1;
x0=[0.59 1.71];
A=[0 1/c ; -1/L -R/L];
B=[0 ; 1/L];
C=[-1 -R];
D=[1];
sistem=ss(A,B,C,D);
[y,t,x]=lsim(sistem,u,t,x0);
figure;
plot(t,y); hold;
plot(ScopeData.time,ScopeData.signals.values,'x');
but for the last plot it said 'Struct contents reference from a non-struct array object.'
What's wrong?
  1 件のコメント
Stephen23
Stephen23 2018 年 4 月 1 日
Eugen Gamentzy' "Answer" moved here:
At first it worked, but when I came back to the program it said that error.

サインインしてコメントする。

採用された回答

Walter Roberson
Walter Roberson 2018 年 3 月 31 日
ScopeData is only created by the Simulink Scope Block https://www.mathworks.com/help/sldrt/ug/set-scope-parameters-for-logging-to-workspace.html or equivalent for Simulink Real Time. Apart from that ScopeData does not exist.
  2 件のコメント
Stephen23
Stephen23 2018 年 4 月 1 日
Eugen Gamentzy's "Answer" moved here:
I've made the Simulink ciruit as well, and logged the data from the scope as an array.
Eugen Gamentzy
Eugen Gamentzy 2018 年 4 月 1 日
I got it working, thank you very much mate :D

サインインしてコメントする。

その他の回答 (1 件)

Eugen Gamentzy
Eugen Gamentzy 2018 年 4 月 1 日
I've made the Simulink ciruit as well, and logged the data from the scope as an array.
  1 件のコメント
Walter Roberson
Walter Roberson 2018 年 4 月 1 日
If ScopeData were initialized as the empty array and later expected to be overwritten with the struct but was not overwritten then you could get that error. You should look at size() and class() of the variable.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSchedule Model Components についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by