Using 2D array in 'From workspace' block in simulink
Mostrar comentarios más antiguos
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
Respuestas (2)
Fangjun Jiang
el 27 de Ag. de 2019
0 votos
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 comentarios
Fangjun Jiang
el 27 de Ag. de 2019
Use this set of data, set the simulation to be discrete, step size to be 1.
Set stop time to be 1, run simulation, see the Display. Then, set the stop time to be 2, simulate again.
time = (0:2)';
M = ones(4,5,length(time));
M(:,:,2)=M(:,:,2)+1.1;
M(:,:,3)=M(:,:,3)+2.2;
datastruct.time = time;
datastruct.signals.values = M;
datastruct.signals.dimensions = size(M,[1,2]);
Chaabane
el 28 de Ag. de 2019
Fangjun Jiang
el 28 de Ag. de 2019
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).
Categorías
Más información sobre Sources en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

