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

5 visualizzazioni (ultimi 30 giorni)
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 Commento
dvd7e
dvd7e il 25 Mag 2018
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

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Simulink Functions in Help Center e File Exchange

Prodotti


Release

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by