MATLAB: Hilite_system inside a library block

hilite_system

I am trying to use hilite_system to hilite a simulink block, however that block lies inside a library block. If I open the model and make the call to hilite_system I get an error that the object name is invalid. However if I navigate throught the model into the library block and try again it works. It would appear that the problem is that the library block is not fully "loaded"? Is there a way around this?

Best Answer

It is true. When you open the model, Simulink doesn't automatically load all the customized library blocks.
To make your script work, I suggest adding a line after you open the model.
Open_system(Model); find_system(Model,'FollowLinks','On');