{"id":6728,"date":"2017-09-05T15:32:43","date_gmt":"2017-09-05T20:32:43","guid":{"rendered":"https:\/\/blogs.mathworks.com\/simulink\/?p=6728"},"modified":"2017-09-05T15:33:46","modified_gmt":"2017-09-05T20:33:46","slug":"another-good-reason-to-use-simulink-projects","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/simulink\/2017\/09\/05\/another-good-reason-to-use-simulink-projects\/","title":{"rendered":"Another Good Reason to Use Simulink Projects"},"content":{"rendered":"<p>This week I discovered a super useful a feature of <a title=\"https:\/\/www.mathworks.com\/discovery\/simulink-projects.html (link no longer works)\">Simulink Projects<\/a>.<\/p>\n<p><strong>Renaming a Library<\/strong><\/p>\n<p>If you are using <a href=\"https:\/\/www.mathworks.com\/help\/simulink\/libraries.html\">Simulink Libraries<\/a> to componentize your models, you very likely ran into the following situation at some point.<\/p>\n<p>You create a library block, and use that block in a model:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/simulink\/2017Q3\/libAndTestMdl.png\" alt=\"Using a Library block\" \/><\/p>\n<p>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:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/simulink\/2017Q3\/libNotFound.png\" alt=\"Library not found\" \/><\/p>\n<p>Here are a few ways to deal with that, depending on how your library block is used.<\/p>\n<p><strong>Option 1 - Manual Update<\/strong><\/p>\n<p>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:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/simulink\/2017Q3\/unresolvedLink.png\" alt=\"Library not found\" \/><\/p>\n<p><strong>Option 2 - Forwarding Table<\/strong><\/p>\n<p>If your library is used by hundreds or thousands of users, you should definitely be using a <a href=\"https:\/\/www.mathworks.com\/help\/simulink\/ug\/make-backward-compatible-changes-to-libraries.html\">Forwarding Table<\/a>. I wrote a <a href=\"https:\/\/blogs.mathworks.com\/simulink\/2012\/08\/01\/upgrading-simulink-libraries-with-forwarding-tables-and-transformation-functions\">blog post on this topic<\/a> some time ago so I will not go into deep details here.<\/p>\n<p>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.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/simulink\/2017Q3\/forwardingtable3.png\" alt=\"Forwarding Table\" \/><\/p>\n<p><strong>Option 3 - Simulink Project<\/strong><\/p>\n<p>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.<\/p>\n<p>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.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/simulink\/2017Q3\/renameMenu.png\" alt=\"Rename a library\" \/><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/simulink\/2017Q3\/renameAndUpdate.png\" alt=\"Update Links\" \/><\/p>\n<p>Simply click <strong>Rename and Update<\/strong>, and magic happens, the models now all use the renamed library:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/simulink\/2017Q3\/updatedModel.png\" alt=\"Model using renamed library\" \/><\/p>\n<p><strong>Now it's your turn<\/strong><\/p>\n<p>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.<\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img decoding=\"async\"  class=\"img-responsive\" src=\"https:\/\/blogs.mathworks.com\/images\/simulink\/2017Q3\/updatedModel.png\" onError=\"this.style.display ='none';\" \/><\/div>\n<p>This week I discovered a super useful a feature of Simulink Projects.<br \/>\nRenaming a Library<br \/>\nIf you are using Simulink Libraries to componentize your models, you very likely ran into the following... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/simulink\/2017\/09\/05\/another-good-reason-to-use-simulink-projects\/\">read more >><\/a><\/p>\n","protected":false},"author":41,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[8,24],"tags":[503,378],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/6728"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/users\/41"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/comments?post=6728"}],"version-history":[{"count":10,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/6728\/revisions"}],"predecessor-version":[{"id":6738,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/6728\/revisions\/6738"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/media?parent=6728"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/categories?post=6728"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/tags?post=6728"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}