Is there a way to configure the model such that "<SignalName>" shows empty when using Bus Selector in MATLAB R2024b and before?

6 views (last 30 days)

We are getting a signal name showing as: "&lt;SignalName&gt;" in the signal name property when using a bus selector. Is there way to configure the model such that signal name shows empty instead?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 17 Sep 2024
All the propagated signal names have brackets in their names, but the behavior of making the actual signal name equal to the propagated name with brackets is specific to the bus selector block. It should be noted that you can also introduce brackets or other special symbols to signal names, in which case bus selector will add another pair of brackets to the name.
Therefore, our recommended programmatic way to handle the special case of the bus selector block is to check the parent of the signal. If it is a bus selector, do the special action such as discard the beginning and end brackets from the signal name or do not consider the signal as part of the check, as "MustResolveToSignalObject" is not selectable for these signals anyway. For instance, using:
strcmp(get_param(get_param(signalHandle,'Parent'),'BlockType'),’BusSelector’)
You can know if the source of the "signalHandle" is “BusSelector” or not and then proceed to assign/re-assign the signal name accordingly.
Another use case where "MustResolveToSignalObject" is not selectable is when the signal name is empty. So, alternative option could be to have the same treatment in the check for the signals with empty name and signals coming from the bus selector block. It should be noted that even though the "MustResolveToSignalObject" is not selectable in these use cases, these signals can still be added to the code mapping. The other use case that we have for "MustResolveToSignalObject" not being selectable is if the source of the signal is bus element "inport". This can be checked programmatically by comparing the "BlockType" and "InBusElementPort" properties of the source of the signal:
strcmp(get_param(get_param(signalHandle,'Parent'),'BlockType'),'Inport') &&  strcmp(get_param(get_param(signalHandle,'Parent'),'IsBusElementPort'),'on')
To summarize, there are three use cases where the 'MustResolveToSignalObject' is not selectable:
  1. Signal name is empty.
  2. Signal source is a bus selector.
  3. Signal source is a bus element "inport".

More Answers (0)

Products


Release

R2024b

Community Treasure Hunt

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

Start Hunting!