This enhancement has been incorporated in Release 2010a (R2010a). For previous product releases, read below for any possible workarounds:
The ability to use a command-line command to retrieve the names of propagated signals in a bus signal is not available in Simulink.
To work around this issue, use the following code:
busdemo
ph = get_param('busdemo/Bus Creator', 'porthandles')
set_param(ph.Outport, 'CacheCompiledBusStruct', 'on')
busdemo([],[],[],'compile')
bs = get_param(ph.Outport, 'CompiledBusStruct')
busdemo([],[],[],'term')
The variable 'bs' will contain information on the bus signal coming out of the Bus Creator. You can recursively walk through this structure to determine all actual sources of the bus and hence all source data types, dimensions, signal names, etc.
Note that the following code makes use of the internal compiled property 'CacheCompiledBusStruct' and hence is subject to change in future releases.
Another workaround to retrieve the names of signals in a bus is to pass all the Bus Creator outputs to a Bus Selector block, which selects all of the signals from the Bus Creator block, then use the following code to extract the signal names, where the Bus Selector block is the currently selected block:
get_param(gcb, 'OutputSignals')
Best Answer