{"id":162,"date":"2011-10-25T19:43:00","date_gmt":"2011-10-25T19:43:00","guid":{"rendered":"https:\/\/blogs.mathworks.com\/seth\/2011\/10\/25\/dynamics-mask-icons-for-subsystem-variants\/"},"modified":"2011-10-25T19:43:00","modified_gmt":"2011-10-25T19:43:00","slug":"dynamics-mask-icons-for-subsystem-variants","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/simulink\/2011\/10\/25\/dynamics-mask-icons-for-subsystem-variants\/","title":{"rendered":"Dynamics Mask Icons for Subsystem Variants"},"content":{"rendered":"<p>Today I will illustrate how to combine two features I like: <a href=\"https:\/\/www.mathworks.com\/help\/releases\/R2011b\/toolbox\/simulink\/ug\/bso3yvt.html\">Subsystem Variants<\/a> and <a href=\"https:\/\/www.mathworks.com\/help\/releases\/R2011b\/toolbox\/simulink\/ug\/f8-15210.html\">Masking<\/a>.<\/p>\r\n\r\n<p><strong>The Question<\/strong><\/p>\r\n\r\n<p>I created a subsystem with two variants and I have specific masks for each variant:<\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2011Q3\/variantsWithMask.png\" alt=\"Subsystem variants with different masks\"><\/p>\r\n\r\n<p>I would like to automatically display the mask of the active variant on the top subsystem.<\/p>\r\n\r\n<p><strong>The Solution<\/strong><\/p>\r\n  \r\n<\/p>As you probably guessed, the trick is to define the correct <a href=\"https:\/\/www.mathworks.com\/help\/releases\/R2011b\/toolbox\/simulink\/gui\/f8-21507.html\">Icon Drawing Commands<\/a> for the top subsystem. After juggling with multiple options, I came up with the following process:<\/p>\r\n\r\n<ul>\t\r\n        <li>Use <a href=\"https:\/\/www.mathworks.com\/help\/releases\/R2011b\/toolbox\/simulink\/slref\/get_param.html\">get_param<\/a> to determine the active variant<\/li>\r\n\t<li>Use <a href=\"https:\/\/www.mathworks.com\/help\/releases\/R2011b\/toolbox\/simulink\/slref\/find_system.html\">find_system<\/a> to determine the subsystem corresponding to the active variant<\/li>\r\n\t<li>Use <a href=\"https:\/\/www.mathworks.com\/help\/releases\/R2011b\/toolbox\/simulink\/slref\/get_param.html\">get_param<\/a> to obtain a string containing the Icon Drawing Commands of the active variant<\/li>\r\n\t<li>Evaluate this string as the top subsystem Icon Drawing Commands<\/li>\r\n<\/ul>\r\n\r\n<p>All together, the Mask Editor should look like this:<\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2011Q3\/VariantMaskEditor.png\" alt=\"Icon Drawing Commands seen in the Mask Editor\"><\/p>\r\n\r\n<p>And your model will behave like this:<\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2011Q3\/MaskVariant.gif\" alt=\"Subsystem variants with different masks, in action!\"><\/p>\r\n\r\n<p><strong>Now it's your turn<\/strong><\/p>\r\n\r\n<p>Have you integrated Subsystem Variants in your workflow? Leave a <a href=\"https:\/\/blogs.mathworks.com\/seth\/?p=162&amp;#comment\">comment here<\/a>.<\/p>\r\n","protected":false},"excerpt":{"rendered":"<p>Today I will illustrate how to combine two features I like: Subsystem Variants and Masking.\r\n\r\nThe Question\r\n\r\nI created a subsystem with two variants and I have specific masks for each... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/simulink\/2011\/10\/25\/dynamics-mask-icons-for-subsystem-variants\/\">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,47,24],"tags":[452,441,230],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/162"}],"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=162"}],"version-history":[{"count":0,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/162\/revisions"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/media?parent=162"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/categories?post=162"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/tags?post=162"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}