{"id":2265,"date":"2013-06-01T07:05:48","date_gmt":"2013-06-01T12:05:48","guid":{"rendered":"https:\/\/blogs.mathworks.com\/seth\/?p=2265"},"modified":"2013-06-01T07:05:48","modified_gmt":"2013-06-01T12:05:48","slug":"model-explorer-or-command-line","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/simulink\/2013\/06\/01\/model-explorer-or-command-line\/","title":{"rendered":"Model Explorer or Command Line?"},"content":{"rendered":"<p>Today I would like to ask you a question.<\/p>\r\n\r\n<p>This week I received a large model where I wanted to find all the <a href=\"https:\/\/www.mathworks.com\/help\/simulink\/slref\/ndlookuptable.html\">Lookup Table<\/a> blocks and modify their <tt>Index Search Method<\/tt> parameter. Since the model was quite large and I was not familiar with it, manually navigating to each block, opening its dialog and modifying it was not an option.<\/p>\r\n\r\n<p>So my question is: <em>How would you accomplish this task?<\/em><\/p>\r\n\r\n<p>Here are two options I considered.<\/p>\r\n\r\n<p><strong>Using functions at the MATLAB command prompt<\/strong><\/p>\r\n\r\n<p>For a long time, when I needed to find or modify blocks in a large Simulink model, I used the command prompt and functions like <tt><a href=\"https:\/\/www.mathworks.com\/help\/simulink\/slref\/find_system.html\">find_system<\/a><\/tt>, <tt><a href=\"https:\/\/www.mathworks.com\/help\/simulink\/slref\/hilite_system.html\">hilite_system<\/a><\/tt> and <tt><a href=\"https:\/\/www.mathworks.com\/help\/simulink\/slref\/set_param.html\">set_param<\/a><\/tt>.<\/p>\r\n\r\n<p>For the example described above, I can find the blocks using <tt><a href=\"https:\/\/www.mathworks.com\/help\/simulink\/slref\/find_system.html\">find_system<\/a><\/tt> and see how they are connected in the model using <tt><a href=\"https:\/\/www.mathworks.com\/help\/simulink\/slref\/hilite_system.html\">hilite_system<\/a><\/tt>:<\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2013Q2\/cmdLineFind.png\" alt=\"Finding blocks from command line\" \/><\/p>\r\n\r\n<p>To change the <tt>Index Search Method<\/tt>, I can use <tt><a href=\"https:\/\/www.mathworks.com\/help\/simulink\/slref\/set_param.html\">set_param<\/a><\/tt> on the previous results:<\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2013Q2\/cmdLineSet.png\" alt=\"Configuring blocks from command line\" \/><\/p>\r\n\r\n<p><strong>Using the Model Explorer<\/strong><\/p>\r\n\r\n<p>Recently, I started using the <a title=\"https:\/\/www.mathworks.com\/help\/simulink\/ug\/the-model-explorer-overview.html (link no longer works)\">Model Explorer<\/a> for this type of task and I think it is very efficient.<\/p>\r\n\r\n<p>For the same task as above, I can easily search by block type. One thing I like is that I do not need to remember the exact string for the block type. The drop down looks at my model and offers me a list based on the blocks in my model.<\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2013Q2\/modelExplorerBlkType.png\" alt=\"Finding blocks using the Model Explorer\" \/><\/p>\r\n\r\n<p>In the list of results, the Path column is a hyperlink I can click to immediately see where the block is in the model.<\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2013Q2\/modelExplorerHilite.png\" alt=\"Finding blocks using the Model Explorer\" \/><\/p>\r\n\r\n<p>To edit the <tt>Index Search Method<\/tt> for all the blocks found, I:\r\n<ul>\r\n<li>Add a column for this property<\/li>\r\n<li>Select all the blocks using \"shitf+Click\"<\/li>\r\n<li>Set the value for one instance, and it applies to all selected blocks<\/li>\r\n<\/ul><\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2013Q2\/modelExplorerSet.png\" alt=\"Finding blocks using the Model Explorer\" \/><\/p>\r\n\r\n<p><strong>Now it's your turn<\/strong><\/p>\r\n\r\n<p>What is your workflow to find and edit blocks in a large model? Let us know by leaving a <a href=\"https:\/\/blogs.mathworks.com\/seth\/?p=2265&#comment\">comment here<\/a>.<\/p>\r\n","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img decoding=\"async\"  class=\"img-responsive\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2013Q2\/modelExplorerSet.png\" onError=\"this.style.display ='none';\" \/><\/div><p>Today I would like to ask you a question.\r\n\r\nThis week I received a large model where I wanted to find all the Lookup Table blocks and modify their Index Search Method parameter. Since the model was... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/simulink\/2013\/06\/01\/model-explorer-or-command-line\/\">read more >><\/a><\/p>","protected":false},"author":41,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[15,33],"tags":[154],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/2265"}],"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=2265"}],"version-history":[{"count":17,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/2265\/revisions"}],"predecessor-version":[{"id":2284,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/2265\/revisions\/2284"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/media?parent=2265"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/categories?post=2265"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/tags?post=2265"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}