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

5 ビュー (過去 30 日間)
dvd7e
dvd7e 2018 年 5 月 24 日
コメント済み: dvd7e 2018 年 5 月 25 日
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 Center および File ExchangeSimulink Functions についてさらに検索

製品


リリース

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by