Not a 'Simulink.Signal' object

123 Ansichten (letzte 30 Tage)
Mihir Tasgaonkar
Mihir Tasgaonkar am 17 Jan. 2023
Bearbeitet: Fangjun Jiang am 18 Jan. 2023
I've been trying to compile a model that contains multiple custom library blocks that I've designed for reusability throughout the model. When I try to build the model, I get the following error:
"Failed to evaluate mask initialization commands. Caused by: Variable ___ is resolved in workspace ('base') for block ____ but it is not a 'Simulink.Signal' object"
The puzzling thing about this is that it shows this error for 5 out of 7 instances where I've used this particular custom library block. The errors are highly inconsistent too, in the sense that a seemingly error-free model on one system contains errors when built on another system. Can anyone help out? I've never found a proper solution to this particular error.
Thanks in advance.
EDIT: I just went through the Model Explorer and it contains signals with the same name as the variable for which it is showing an error.

Antworten (1)

Fangjun Jiang
Fangjun Jiang am 18 Jan. 2023
Bearbeitet: Fangjun Jiang am 18 Jan. 2023
Select a signal line in your model, right click, select Properties, type in a name "SignalA", and check the check-box "Signal name must resolve to signal object".
Then it requires you to create a Simulink.Signal object in the workspace, such as SignalA=Simulink.Signal and then specify some property values. If the signal object does not exist, or variable "SignalA" exist but it is not a signal object, then the error in your post will appear.
It sounds like you are not aware of this technique, then most likely you don't need it. So remove the signal line name inside the library block.
This technique should not be used inside a library block anyway. For the same signal name (so is the signal object name), it only allows one instance in the whole model. So if you implement this inside the library block and it is used multiple times, then another error will occur.

Produkte


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by