Cell operations in eml

I need to perform a cell operation in a MATLAB embedded function in simulink, but the problem is that EML do not support cell operation.
I can save the cell array in a .mat file, load it and use the cell array as a constant (in the constant block) but I still need to access the cell before I use it as an input for the embedded function. I've tried using the MATLAB function after the constant (ie: u{1}) but it does not work either.
So any help?

1 个评论

I don't know that cell-arrays are even allowed in Simulink.

请先登录,再进行评论。

回答(1 个)

Yes, it is absolutely possible to do it in Simulink.
E.g.:
U{1} = 15;
save('MYdata.mat', 'U')
..
load('MYdata.mat')
You can save (e.g.: save('MYdata.mat', 'U') ) the input constant (e.g.: U{1} = 15) in cell array in *.mat file and load it in MATLAB workspace (load MYdata.mat). Then you can recall it (e.g.: U) in Simulink's constant block using MATLAB's built in command in your constant block cell2mat(U) - see this screenshot.

类别

Community Treasure Hunt

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

Start Hunting!

Translated by