How to use time varying structures in Simulink's embedded matlab

3 次查看(过去 30 天)
I would like to manipulate a data structure inside of a Simulink Matlab Function, for example:
function y = fcn(data)
y = data.a + data.b;
where the number and names of the fields of the structure "data" are constant but the actual quantities inside of the fields are time varying. My understanding (and verified through dummy examples) is that the only way to reference an input data structure that is time varying in a Simulink embedded matlab function block is to use a Bus Object definition (as opposed to skipping the Bus Object and just using a bus creator block).
However, a driving constraint is that there can be more fields in "data" than just "a" and "b". Normally in Matlab this would not be a problem, the code above would just ignore any extra fields. However, in Simulink a Bus Object will not run if there are any extra fields in the input, even if they are not used.
Is there a way around this?
Thank you!
  1 个评论
dvd7e
dvd7e 2018-5-25
Is this something that Matlab 2018a would address? In the release notes I see some items about variant buses, I'm not sure if that would be applicable or not

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Simulink Functions 的更多信息

产品


版本

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by