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

4 vues (au cours des 30 derniers jours)
dvd7e
dvd7e le 24 Mai 2018
Commenté : dvd7e le 25 Mai 2018
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 commentaire
dvd7e
dvd7e le 25 Mai 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

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Simulink Functions dans Help Center et File Exchange

Produits


Version

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by