MATLAB: Does acquiring the parameter BusStruct cause MATLAB to crash

simulink

In my model I have a block that tries to get the parameter 'BusStruct' during the 'InitFcn' callback.  However, when I try to update the model MATLAB crashes. Why does this occur?

Best Answer

The parameter 'BusStruct' is an undocumented parameter. In the past, with the property 'BusStruct', users were able to get the hierarchical structure of a bus signal from a BusSelector or BusCreator block in a Simulink model after model update diagram (Ctrl+D).
You would select, for instance, a BusSelector block in your model, and type in MATLAB command window. For testing you can open demo Simulink model busdemo.slx :
tmp = get_param(gcbh,'BusStruct') % Command is undocumented and can be deprecated in future releases!
ans = 
  2×1 struct array with fields:
    name
    src
    srcPort
    signals
Using 'BusStruct' property is not a recommended workflow. Instead, you could look at the 'SignalHierarchy' for the bus to obtain similar information. The example found under the section 'Bus Signal Example' in the link below demonstrates how to get this information.