5

Is there anyway to simply append a signal to a bus in Simulink? This doesn't seem to be that difficult, but I haven't found a nice way to do it. I can only think of two ways to currently accomplish this:

  1. Select all signals in the bus with a bus selector, then create a bus with all those signals plus the signal to be append using a bus creator. (this is what I am currently doing)
  2. "Pre-allocate" a space in the bus for the signal to be append beforehand then simply replace its value with the value of the actual signal using a bus assignment block.

Is there a reason as to why Simulink cannot append a signal to a bus? Is it because on the backend they are represents as structures (or MATLAB's equivalent) and a property cannot be added to a structure at runtime?

celestialorb
  • 1,901
  • 7
  • 29
  • 50
  • I would say that you can't because buses are types (structs) and appending a signal would create a new type. Your 2 ways of doing it seem fine. In my opinion, option 1 creates more clutter, but is less error prone than option 2. – pmb Oct 25 '13 at 06:19

1 Answers1

0

If you are using a bus object, you can use the Bus Editor to add a bus element to an existing bus.

am304
  • 13,758
  • 2
  • 22
  • 40
  • 1
    Yes, but this changes the type throughout the whole model, this would be equivalent to option 2 of "pre-allocating". I think @celestialorb wants to append a signal in the model during runtime, without necessarily creating a new type. – pmb Oct 25 '13 at 13:58
  • @pmb It would still be the same bus object, that you would edit and save after editing (you could save it as different bus object if you so desired), but yes, the changes would be propagated throughout the model wherever that bus object is used. – am304 Oct 25 '13 at 14:48