"From workspace" Simulink

"From workspace" Simulink

拜托,我正在模拟一个动态系统,其中一些输入具有数组形式的真实数据,例如 1*16 或存储在 Matlab 工作区中的 16*16 维矩阵。我已经尝试在 Simulink 中使用 "From Workspace" 块很长时间了。

Blockquote

我的模拟时间是1:10 时间Step:0.01

Blockquote

我的目标:是在我的模拟过程中逐个元素地显示我的数组或矩阵的内容。enter image description here

非常感谢您提供任何有价值的答案。

我建议使用 timeseries 对象,而不是像您那样手动构建结构。它将帮助您使用正确的数据结构并提供更好的反馈。

尝试

%16 timestamps matching your data size, replace with your time infomration
time=0:.1:1.5;
%placeholder for your data
m=rand(1,16);
%create timeseries
ts=timeseries(m,time);

要在 MATLAB 中验证您的时间序列是否符合您的要求,请使用:

ts.plot(); %won't output anything useful with random data.

然后在您的 from Workspace 块中使用 ts