Guy on Simulink

Simulink & Model-Based Design

??? Invalid Simulink object name 6

Posted by Seth Popinchalk,

Did you ever get an error like this?

>> get_param('model_f14/Controller','TreatAsAtomicUnit')
??? Invalid Simulink object name: model_f14/Controller.

Of course. Anytime you have a typo in a call to get_param or set_param, you will get this message. This is very frustrating, especially when you look at the model, and see the block with the very same name!

The mysterious model with a Controller subsystem.

Invisible Characters!

To understand why this was happening, I had to compare the string I was using to the name of the block from using gcb (get current block).

>> s1 = 'model_f14/Controller'
s1 =
>> s2 = gcb
s2 =
>> strcmp(s1,s2)
ans =

The string from gcb looks the same, but then I noticed the size of the signals in the workspace.

The workspace show the two variables, s1 and s2 are lenths 20 and 21 respectively.

The block has a trailing white-space character! Where did this space come from? The space was probably an accidental keystroke while naming the subsystem. This can happen to anyone, so how could you detect it in your model?

Model Guidelines and Model Advisor

Most teams doing Model-Based Design for production work eventually implement modeling guidelines/standards. Modeling standards make it possible for teams to make components that work well together and look like they were made by the same team. Often, modeling standards include rules about what blocks to use, what settings to use, how to architect the model, how to layout the diagram and naming conventions.

The MathWorks Automotive Advisory Board assembled modeling guidelines for control algorithm modeling and many were implemented as Model Advisor checks (as part of Simulink Verification and Validation). The group of checks I need are the Naming Convention checks under the Modeling Standards for MAAB task.

Model Advisor MAAB control algorithm modeling standards, checks for Naming Conventions.

When I selected the Check subsystem names and clicked Run This Check, I got the report you see above. Notice it flagged the model_f14/Controller block as containing an incorrect character. Incorrect characters are those not in the list of allowed characters:

a b c d e f g h i j k l m n o p q r s t u v w x y z
0 1 2 3 4 5 6 7 8 9 _

There are a few standards related to Naming Conventions:

For a moderate to large model, you can imagine the time this type of model check would save you.

What are your modeling standards? Do you run the Model Advisor to check that models conform to the standard? Leave a comment here with your thoughts.

6 CommentsOldest to Newest

Paulo Silva replied on : 1 of 6

I hate the “Invalid Simulink object name” error, the last time that happened to me was yesterday, there was one space character in the block name, other errors I get often are caused by stuff like this

I don’t follow any model standard yet and also don’t use the Model Advisor but it would save me a lot of time!

Seth Popinchalk replied on : 2 of 6

@Paulo Silva – I used to have the very same problem with forward and back slashes. Somehow, I think I just got the right slash type habit.

char replied on : 5 of 6

I am having a similar problem, my model used to be working fine but after removing some blocks that were no longer required the error “invalid simulink name: .” appeared. I tried building that portion of the model but keep having the same error.

LeFish replied on : 6 of 6

I stumbled over the same problem. it showed that an outport was called ‘1/V’. This is not accepted by Simulink because it looks like, that the component 1 has a subcomponent called V included. I used ‘1/V’ with set_param(), gcb,…

Add A Comment

What is 3 + 7?

Preview: hide