
What does the error "the number of signals at the input to the block must match the number of object elements" mean?
45 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
MathWorks Support Team
am 19 Feb. 2019
Bearbeitet: MathWorks Support Team
am 23 Jan. 2023
I am creating a Simulink model in release R2017a where I am using a "Bus Creator" block.
When I try to run the model, I get the following message"
The bus data type TYPE specified in BLOCK is not valid; the number of signals at the input to the block
must match the number of object elements.
I have three elements at the input to the "Bus Creator" and have specified the output as a bus object with three elements of the same data type.
What does this error message mean?
Akzeptierte Antwort
MathWorks Support Team
am 10 Jan. 2023
Bearbeitet: MathWorks Support Team
am 23 Jan. 2023
This error often appears when you are using a specific type of bus in the "Bus Creator" block. You can check this setting in "Output Data Type" of its properties dialog. For example, in the image below, the "Bus Creator" uses a custom bus named "MyBus":

The most common occurrence of this error is when the number of inputs to the "Bus Creator" block do not equal the number of elements in the specified bus type.
Additionally, it can also appear when there is a mismatch between the input signal names and the bus elements' signal names. This is the case asked in the question. This is related to the setting "Override bus signal names from inputs", and unchecking it should resolve the issue.
The "Override bus signal names from inputs" setting causes the names of the incoming signals to determine the names of the elements of the bus. Even if the incoming signals do not have names, the default names of "signal1", "signal2", etc. are used. This creates a problem if you try to set the output data type to be a specific type of bus with specific element names. The names end up not matching and you receive the error message regarding the number of signals not matching.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Signals finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!