Not a 'Simulink.Signal' object

88 次查看(过去 30 天)
Mihir Tasgaonkar
Mihir Tasgaonkar 2023-1-17
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.

回答(1 个)

Fangjun Jiang
Fangjun Jiang 2023-1-18
编辑:Fangjun Jiang 2023-1-18
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.

类别

Help CenterFile Exchange 中查找有关 Signals 的更多信息

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by