フィルターのクリア

Using 2D array in 'From workspace' block in simulink

27 ビュー (過去 30 日間)
Chaabane
Chaabane 2019 年 8 月 27 日
コメント済み: Fangjun Jiang 2019 年 8 月 28 日
Hello,
I have a simulink model that gets it's input data from 'from workspace' block, I have the data parameter in this block setting to [time data], where time is M by 1 and data is M by N array. Everything is working and the output is as expected.
Now I want to use a 2D array so I changed data from M by N to M by N by Z but I'm getting the following error :
  • Dimensions of arrays being concatenated are not consistent.
The idea is for each time(i) the simulink model handle a 2D array of data(i,:,:). Not sure if this makes sense !
Would really appreciate it if any one here can give me some feedback and mybe tell me what I'm doing wrong here ?
Thank you

回答 (2 件)

Fangjun Jiang
Fangjun Jiang 2019 年 8 月 27 日
Click "Help" button on the dialog of the "From Workspace" block, open the example model for "Read 2-D Signals in Structure Format From Workspace"
  3 件のコメント
Chaabane
Chaabane 2019 年 8 月 28 日
thank you for the update, but unfortunetly I need to run it automatically for huge set of data so this won't work in my case!
Fangjun Jiang
Fangjun Jiang 2019 年 8 月 28 日
This is just an illustration on how you suppose to contruct your data. At each time(i), the "From Workspace" will read in a 2D array of data(:,:,i).

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


Chaabane
Chaabane 2019 年 8 月 27 日
Thank you for your answer, I have already tried this example but for me, it is very confusing how this works on Simulink!
If I use the following code
time = (1:50)';
data = zeros(50,8);
and add it to the 'from workspace' block as a vector [time data]
1.PNG
The output size is 8 bytes. So simulink go throught time and uses the data that corresponds to that time.
But if I use structure like the example (see my code below), it seems that all the data in datastruct is used at once which is not something practical in my case.
2.PNG
time = (1:50)';
data = zeros(50,8);
M = repmat(data,[1 1 length(time)]);
datastruct.time = time;
datastruct.signals.values = M;
datastruct.signals.dimensions = size(data);

カテゴリ

Help Center および File ExchangeEvent Functions についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by