How to access data of an iddata object in a cell array?

14 ビュー (過去 30 日間)
Benjamin Pommer
Benjamin Pommer 2022 年 12 月 5 日
コメント済み: Star Strider 2022 年 12 月 5 日
Dear Matlab community!
I have a cell array where I store iddata objects with input signals and output signals. How can I inquire the input variable of the iddata object inside the cell array?
Best regards
Benjamin

採用された回答

Star Strider
Star Strider 2022 年 12 月 5 日
The iddata object is a structure, so in this instance, use cell array indexing and structure referencing to get its contents —
Fs = 500;
L = 50;
t = linspace(0, L-1, L).'/Fs;
u = [0 ones(1,L-1)].';
sys = tf([1 0], [1 0 1], 1/Fs);
y = lsim(sys, u, t);
% figure
% plot(t, y)
% hold on
% plot(t, u)
% hold off
% grid
k = 1;
data{k} = iddata(y, u, 1/Fs)
data = 1×1 cell array
{50×1×1 iddata}
Input = data{k}.InputData % Return Input Data From Cell Array Of 'iddata' Objects
Input = 50×1
0 1 1 1 1 1 1 1 1 1
I created data to test this, since none were provided.
.
  2 件のコメント
Benjamin Pommer
Benjamin Pommer 2022 年 12 月 5 日
Thank you
Star Strider
Star Strider 2022 年 12 月 5 日
As always, my pleasure!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Preparation Basics についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by