I have a structure that has nested structures. I use Simulink.Bus.createObject to create a bus object so I can use it in my Simulink model. This all works fine, but I noticed that so many buses are created and many are just duplicates in their format. Is there a way to prevent all these duplicates from being generated or to consolidate them?
An idea of what I'm doing:
var.A.ID = 1;var.A.type = 1;var.A.data.response = 0;var.A.data.validity = 0;var.B.ID = 2;var.B.type = 2;var.B.data.response = 0;var.B.data.validity = 0;Simulink.Bus.createObject(var);
This will create the buses required to represent this struct variable in Simulink however a bus for the "data" variable is created twice. User gets "data" and "slBus1_data". And the bus for var.A uses "data" and the bus for var.B uses "slBus1_data". This creates overhead when using Simulink as this structure gets much larger and more complex.
Is there a way to consolidate identical buses without having to do it manually?
Best Answer