This week I discovered a super useful a feature of Simulink Projects.
Renaming a Library
If you are using Simulink Libraries to componentize your models, you very likely ran into the following situation at some point.
You create a library block, and use that block in a model:
After some time, you decide that the library file needs to be renamed. The next time you open your model, here is what you get:
Here are a few ways to deal with that, depending on how your library block is used.
Option 1 - Manual Update
Let's begin with the obvious one. If your library subsystem is used only once in one model, the quickest solution is probably to simply double-click on the missing link block and type the new name of the library:
Option 2 - Forwarding Table
For this post, let's just say that Forwarding Tables give you all the flexibility you need when re-organizing libraries, but requires some work to implement. I typically implement it only when I know many other users will be affected by the re-organization.
Option 3 - Simulink Project
If you are working on a project where you have library blocks used multiple times in various project-related models, you will love this feature.
When all your models and libraries are in a Simulink Project, if you rename a library file, the project will automatically run a dependency analysis and offer you to update all the instances of the blocks from the library.
Simply click Rename and Update, and magic happens, the models now all use the renamed library:
Now it's your turn
Are you already taking advantage of this feature? What's is your preferred way to manage library reorganization? Let us know in the comments below.
コメントを残すには、ここ をクリックして MathWorks アカウントにサインインするか新しい MathWorks アカウントを作成します。