{"id":17598,"date":"2025-03-27T15:24:50","date_gmt":"2025-03-27T19:24:50","guid":{"rendered":"https:\/\/blogs.mathworks.com\/simulink\/?p=17598"},"modified":"2025-03-28T11:00:36","modified_gmt":"2025-03-28T15:00:36","slug":"visualizing-the-number-of-blocks-in-a-simulink-model","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/simulink\/2025\/03\/27\/visualizing-the-number-of-blocks-in-a-simulink-model\/","title":{"rendered":"Visualizing the number of blocks in a Simulink model?"},"content":{"rendered":"<div class = rtcContent><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><a href = \"https:\/\/matlab.mathworks.com\/open\/github\/v1?repo=simulink\/blog&amp;project=2025_03_14_SimulinkSankey\/SimulinkSankey.prj\"><img class = \"imageNode\" src = \"https:\/\/blogs.mathworks.com\/simulink\/files\/SimulinkSankey.mlx-03-28-25_1.png\" width = \"136\" height = \"21\" alt = \"\" style = \"vertical-align: baseline; width: 136px; height: 21px;\"><\/img><\/a><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>I was recently discussing different ways to visualize the content of a Simulink model with colleagues. Working in technical support, I receive models from users every day and it's always useful to quickly get a feeling of \"<\/span><span style=' font-style: italic;'>what's in that model?<\/span><span>\". <\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>At some point during the discussion, my colleague <\/span><a href = \"https:\/\/www.mathworks.com\/matlabcentral\/profile\/authors\/12935569\"><span>Reid Spence<\/span><\/a><span> said \"<\/span><span style=' font-style: italic;'>This would probably be useful to visualize the number of blocks in different subsystems using something like a <\/span><a href = \"https:\/\/en.wikipedia.org\/wiki\/Sankey_diagram\" target=\"_blank\"><span style=' font-style: italic;'>Sankey diagram<\/span><\/a><span>\".<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>I thought that idea had potential, so I decided to give it a try.<\/span><\/div><h2  style = 'margin: 3px 10px 5px 4px; padding: 0px; line-height: 25px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: 700; text-align: left; '><span>Chart Examples<\/span><\/h2><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>When I need a fancy type of visualization that does not ship with MATLAB, I usually begin my search with <\/span><a href = \"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/\"><span>MATLAB File Exchange<\/span><\/a><span>. In this case, my search led me to <\/span><a href = \"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/65857-chart-examples\"><span>Chart Examples<\/span><\/a><span> by my colleague <\/span><a href = \"https:\/\/www.mathworks.com\/matlabcentral\/profile\/authors\/2987674\"><span>Ken Deeley<\/span><\/a><span>. Based on the image on File Exchange, I think this will do what I need!<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><img class = \"imageNode\" src = \"https:\/\/blogs.mathworks.com\/simulink\/files\/SimulinkSankey.mlx-03-28-25_2.png\" width = \"925\" height = \"897\" alt = \"\" style = \"vertical-align: baseline; width: 925px; height: 897px;\"><\/img><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Looking at the examples included, I could quickly see that:<\/span><\/div><ul  style = 'margin: 10px 0px 20px; padding-left: 0px; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-size: 14px; '><li  style = 'margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap; '><span>The function <\/span><span style=' font-family: monospace;'>SankeyChart<\/span><span> takes a <\/span><a href = \"https:\/\/www.mathworks.com\/help\/matlab\/ref\/digraph.html\"><span style=' font-family: monospace;'>digraph<\/span><\/a><span> as input<\/span><\/li><li  style = 'margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap; '><span style=' font-family: monospace;'>digraph<\/span><span> can take a <\/span><a href = \"https:\/\/www.mathworks.com\/help\/matlab\/ref\/table.html\"><span style=' font-family: monospace;'>table<\/span><\/a><span> as input<\/span><\/li><li  style = 'margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap; '><span>The table needs two variables: <\/span><span style=' font-family: monospace;'>EndNodes<\/span><span> can be a two-column string array, and <\/span><span style=' font-family: monospace;'>Weight<\/span><span>, for the weight of each node<\/span><\/li><\/ul><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Here is a simple example:<\/span><\/div><div style=\"background-color: #F5F5F5; margin: 10px 15px 10px 0; display: inline-block\"><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 1px solid rgb(217, 217, 217); border-bottom: 0px none rgb(33, 33, 33); border-radius: 4px 4px 0px 0px; padding: 6px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace, Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >EndNodes = [<\/span><span style=\"color: #a709f5;\">\"a\"<\/span><span >,<\/span><span style=\"color: #a709f5;\">\"b\"<\/span><span >;<\/span><span style=\"color: #a709f5;\">\"a\"<\/span><span >,<\/span><span style=\"color: #a709f5;\">\"c\"<\/span><span >;<\/span><span style=\"color: #a709f5;\">\"b\"<\/span><span >,<\/span><span style=\"color: #a709f5;\">\"d\"<\/span><span >;<\/span><span style=\"color: #a709f5;\">\"b\"<\/span><span >,<\/span><span style=\"color: #a709f5;\">\"e\"<\/span><span >];<\/span><\/span><\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace, Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >Weight = [5 2 3 1]';<\/span><\/span><\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace, Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >T = table(EndNodes,Weight);<\/span><\/span><\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace, Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >D = digraph(T);<\/span><\/span><\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace, Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >f = uifigure;<\/span><\/span><\/div><\/div><div class=\"inlineWrapper outputs\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 1px solid rgb(217, 217, 217); border-radius: 0px; padding: 0px 45px 4px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace, Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >SC = SankeyChart( <\/span><span style=\"color: #a709f5;\">\"Parent\"<\/span><span >, f, <\/span><span style=\"color: #a709f5;\">\"GraphData\"<\/span><span >, D );<\/span><\/span><\/div><div  style = 'color: rgb(33, 33, 33); padding: 10px 0px 6px 17px; background: rgb(220, 220, 220) none repeat scroll 0% 0% \/ auto padding-box border-box; font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; overflow-x: hidden; line-height: 17.234px; '><div class=\"inlineElement eoOutputWrapper disableDefaultGestureHandling embeddedOutputsWarningElement\" uid=\"66FFD126\" prevent-scroll=\"true\" data-testid=\"output_0\" tabindex=\"-1\" style=\"width: 1146px; white-space: normal; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\"><div class=\"diagnosticMessage-wrapper diagnosticMessage-warningType eoOutputContent\" tabindex=\"-1\" data-previous-available-width=\"1109\" data-previous-scroll-height=\"19\" data-hashorizontaloverflow=\"false\" role=\"article\" aria-roledescription=\"Use Browse Mode to explore \" aria-description=\"warning output \" style=\"max-height: 261px; white-space: normal; font-style: normal; color: rgb(179, 98, 5); font-size: 12px;\"><div class=\"diagnosticMessage-messagePart\" style=\"white-space: pre-wrap; font-style: normal; color: rgb(179, 98, 5); font-size: 12px;\">Warning: The given graph is unbalanced.<\/div><div class=\"diagnosticMessage-stackPart\" style=\"white-space: pre; font-style: normal; color: rgb(179, 98, 5); font-size: 12px;\"><\/div><\/div><\/div><div class=\"inlineElement eoOutputWrapper disableDefaultGestureHandling embeddedOutputsFigure\" uid=\"6AFE7A40\" prevent-scroll=\"true\" data-testid=\"output_1\" tabindex=\"-1\" ><div class=\"figureElement eoOutputContent\" role=\"article\" aria-roledescription=\"Use Browse Mode to explore \" aria-description=\"figure output \"><img decoding=\"async\" class=\"figureImage figureContainingNode\" src=\"https:\/\/blogs.mathworks.com\/simulink\/files\/SimulinkSankey.mlx-03-28-25_3.png\" style=\"width: 560px;\"><\/div><div class=\"outputLayer selectedOutputDecorationLayer doNotExport\" aria-hidden=\"true\"><\/div><div class=\"outputLayer activeOutputDecorationLayer doNotExport\" aria-hidden=\"true\"><\/div><div class=\"outputLayer scrollableOutputDecorationLayer doNotExport\" aria-hidden=\"true\"><\/div><div class=\"outputLayer navigationFocusLayer doNotExport\" aria-hidden=\"false\" tabindex=\"-1\" role=\"application\" aria-label=\"figure output \"><\/div><\/div><\/div><\/div><\/div><div  style = 'margin: 10px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>In some sense, it's kind of like a fully expanded Model Browser, with the additional possibility to give weights to each subsystem, corresponding to the number fo blocks they contain.<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><img class = \"imageNode\" src = \"https:\/\/blogs.mathworks.com\/simulink\/files\/SimulinkSankey.mlx-03-28-25_4.png\" width = \"199\" height = \"201\" alt = \"\" style = \"vertical-align: baseline; width: 199px; height: 201px;\"><\/img><\/div><h2  style = 'margin: 3px 10px 5px 4px; padding: 0px; line-height: 25px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: 700; text-align: left; '><span>From Model to Table<\/span><\/h2><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>The first and most important thing I had to do is create the table. I came up with this simple recursive function:<\/span><\/div><div class = 'preformatted-matlab' style = 'margin: 10px 3px 10px 55px; padding: 10px 10px 10px 5px; '><div  style = 'border-left: 0px none rgb(33, 33, 33); border-right: 0px none rgb(33, 33, 33); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px; line-height: 15.6px; min-height: 16px; white-space: pre; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 12px; '><span style=\"white-space: pre\"><span style=\"color: #0e00ff;\">function <\/span><span >T = mdlTable(T,blk)<\/span><\/span><\/div><div  style = 'border-left: 0px none rgb(33, 33, 33); border-right: 0px none rgb(33, 33, 33); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px; line-height: 15.6px; min-height: 16px; white-space: pre; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 12px; '><span style=\"white-space: pre\"><span >opts = Simulink.FindOptions;<\/span><\/span><\/div><div  style = 'border-left: 0px none rgb(33, 33, 33); border-right: 0px none rgb(33, 33, 33); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px; line-height: 15.6px; min-height: 16px; white-space: pre; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 12px; '><span style=\"white-space: pre\"><span >opts.FollowLinks = true;<\/span><\/span><\/div><div  style = 'border-left: 0px none rgb(33, 33, 33); border-right: 0px none rgb(33, 33, 33); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px; line-height: 15.6px; min-height: 16px; white-space: pre; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 12px; '><span style=\"white-space: pre\"><span >opts.SearchDepth = 1;<\/span><\/span><\/div><div  style = 'border-left: 0px none rgb(33, 33, 33); border-right: 0px none rgb(33, 33, 33); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px; line-height: 15.6px; min-height: 16px; white-space: pre; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 12px; '><span style=\"white-space: pre\"><span style=\"color: #008013;\">% Find the subsystems at this level<\/span><\/span><\/div><div  style = 'border-left: 0px none rgb(33, 33, 33); border-right: 0px none rgb(33, 33, 33); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px; line-height: 15.6px; min-height: 16px; white-space: pre; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 12px; '><span style=\"white-space: pre\"><span >blks = Simulink.findBlocksOfType(blk,<\/span><span style=\"color: #a709f5;\">'SubSystem'<\/span><span >,opts);<\/span><\/span><\/div><div  style = 'border-left: 0px none rgb(33, 33, 33); border-right: 0px none rgb(33, 33, 33); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px; line-height: 15.6px; min-height: 16px; white-space: pre; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 12px; '><span style=\"white-space: pre\"><span style=\"color: #008013;\">% blockpath of the \"source\" in Sankey<\/span><\/span><\/div><div  style = 'border-left: 0px none rgb(33, 33, 33); border-right: 0px none rgb(33, 33, 33); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px; line-height: 15.6px; min-height: 16px; white-space: pre; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 12px; '><span style=\"white-space: pre\"><span >SrcName = string(getfullname(get_param(blk,<\/span><span style=\"color: #a709f5;\">'handle'<\/span><span >)));<\/span><\/span><\/div><div  style = 'border-left: 0px none rgb(33, 33, 33); border-right: 0px none rgb(33, 33, 33); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px; line-height: 15.6px; min-height: 16px; white-space: pre; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 12px; '><span style=\"white-space: pre\"><span style=\"color: #0e00ff;\">for <\/span><span >i = 1:length(blks)<\/span><\/span><\/div><div  style = 'border-left: 0px none rgb(33, 33, 33); border-right: 0px none rgb(33, 33, 33); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px; line-height: 15.6px; min-height: 16px; white-space: pre; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 12px; '><span style=\"white-space: pre\"><span >&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #008013;\">% blockpath of the \"destination\" in Sankey<\/span><\/span><\/div><div  style = 'border-left: 0px none rgb(33, 33, 33); border-right: 0px none rgb(33, 33, 33); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px; line-height: 15.6px; min-height: 16px; white-space: pre; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 12px; '><span style=\"white-space: pre\"><span >&nbsp;&nbsp;&nbsp;&nbsp;DestName = string(getfullname(blks(i)));<\/span><\/span><\/div><div  style = 'border-left: 0px none rgb(33, 33, 33); border-right: 0px none rgb(33, 33, 33); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px; line-height: 15.6px; min-height: 16px; white-space: pre; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 12px; '><span style=\"white-space: pre\"><span >&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #008013;\">% Number of blocks inside this subsystem<\/span><\/span><\/div><div  style = 'border-left: 0px none rgb(33, 33, 33); border-right: 0px none rgb(33, 33, 33); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px; line-height: 15.6px; min-height: 16px; white-space: pre; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 12px; '><span style=\"white-space: pre\"><span >&nbsp;&nbsp;&nbsp;&nbsp;opts.SearchDepth = -1;<\/span><\/span><\/div><div  style = 'border-left: 0px none rgb(33, 33, 33); border-right: 0px none rgb(33, 33, 33); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px; line-height: 15.6px; min-height: 16px; white-space: pre; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 12px; '><span style=\"white-space: pre\"><span >&nbsp;&nbsp;&nbsp;&nbsp;Nchilds = max(length(Simulink.findBlocks(blks(i),opts)),1);<\/span><\/span><\/div><div  style = 'border-left: 0px none rgb(33, 33, 33); border-right: 0px none rgb(33, 33, 33); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px; line-height: 15.6px; min-height: 16px; white-space: pre; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 12px; '><span style=\"white-space: pre\"><span >&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #008013;\">% Fill the table<\/span><\/span><\/div><div  style = 'border-left: 0px none rgb(33, 33, 33); border-right: 0px none rgb(33, 33, 33); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px; line-height: 15.6px; min-height: 16px; white-space: pre; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 12px; '><span style=\"white-space: pre\"><span >&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0e00ff;\">if <\/span><span >isempty(T)<\/span><\/span><\/div><div  style = 'border-left: 0px none rgb(33, 33, 33); border-right: 0px none rgb(33, 33, 33); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px; line-height: 15.6px; min-height: 16px; white-space: pre; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 12px; '><span style=\"white-space: pre\"><span >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;T = table([SrcName,DestName], Nchilds,<\/span><span style=\"color: #a709f5;\">'VariableNames'<\/span><span >,[<\/span><span style=\"color: #a709f5;\">\"EndNodes\"<\/span><span >,<\/span><span style=\"color: #a709f5;\">\"Weight\"<\/span><span >]);<\/span><\/span><\/div><div  style = 'border-left: 0px none rgb(33, 33, 33); border-right: 0px none rgb(33, 33, 33); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px; line-height: 15.6px; min-height: 16px; white-space: pre; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 12px; '><span style=\"white-space: pre\"><span >&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0e00ff;\">else<\/span><\/span><\/div><div  style = 'border-left: 0px none rgb(33, 33, 33); border-right: 0px none rgb(33, 33, 33); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px; line-height: 15.6px; min-height: 16px; white-space: pre; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 12px; '><span style=\"white-space: pre\"><span >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;T(end+1,:) = {[SrcName,DestName], Nchilds}; <\/span><span style=\"color: #008013;\">%#ok&lt;AGROW&gt;<\/span><\/span><\/div><div  style = 'border-left: 0px none rgb(33, 33, 33); border-right: 0px none rgb(33, 33, 33); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px; line-height: 15.6px; min-height: 16px; white-space: pre; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 12px; '><span style=\"white-space: pre\"><span >&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0e00ff;\">end<\/span><\/span><\/div><div  style = 'border-left: 0px none rgb(33, 33, 33); border-right: 0px none rgb(33, 33, 33); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px; line-height: 15.6px; min-height: 16px; white-space: pre; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 12px; '><span style=\"white-space: pre\"><span >&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #008013;\">% Run the same on found subsystems<\/span><\/span><\/div><div  style = 'border-left: 0px none rgb(33, 33, 33); border-right: 0px none rgb(33, 33, 33); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px; line-height: 15.6px; min-height: 16px; white-space: pre; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 12px; '><span style=\"white-space: pre\"><span >&nbsp;&nbsp;&nbsp;&nbsp;T = mdlTable(T,blks(i));<\/span><\/span><\/div><div  style = 'border-left: 0px none rgb(33, 33, 33); border-right: 0px none rgb(33, 33, 33); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px; line-height: 15.6px; min-height: 16px; white-space: pre; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 12px; '><span style=\"white-space: pre\"><span style=\"color: #0e00ff;\">end<\/span><\/span><\/div><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>It's probably not the most efficient implementation, especially due to the call to <\/span><span style=' font-family: monospace;'>Simulink.findBlocks<\/span><span> in the loop, but that will do the job for now.<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Let's try it with one of our shipping examples: <\/span><a href = \"https:\/\/www.mathworks.com\/help\/simulink\/slref\/air-traffic-control-radar-design.html\"><span>Air Traffic Control Radar Design<\/span><\/a><\/div><div style=\"background-color: #F5F5F5; margin: 10px 15px 10px 0; display: inline-block\"><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 1px solid rgb(217, 217, 217); border-bottom: 0px none rgb(33, 33, 33); border-radius: 4px 4px 0px 0px; padding: 6px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace, Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >openExample(<\/span><span style=\"color: #a709f5;\">'simulink_aerospace\/AirTrafficControlRadarDesignExample'<\/span><span >,<\/span><span style=\"color: #a709f5;\">'workDir'<\/span><span >,pwd)<\/span><\/span><\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 1px solid rgb(217, 217, 217); border-radius: 0px 0px 4px 4px; padding: 0px 45px 4px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace, Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >open_system(<\/span><span style=\"color: #a709f5;\">'aero_atc'<\/span><span >);<\/span><\/span><\/div><\/div><\/div><div  style = 'margin: 10px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><img class = \"imageNode\" src = \"https:\/\/blogs.mathworks.com\/simulink\/files\/SimulinkSankey.mlx-03-28-25_5.png\" width = \"598\" height = \"553\" alt = \"\" style = \"vertical-align: baseline; width: 598px; height: 553px;\"><\/img><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Just looking at the top level, can you guess if there are more blocks inside <\/span><span style=' font-family: monospace;'>Radar<\/span><span>, <\/span><span style=' font-family: monospace;'>Aircraft<\/span><span>, or <\/span><span style=' font-family: monospace;'>Weather<\/span><span>?<\/span><\/div><div style=\"background-color: #F5F5F5; margin: 10px 15px 10px 0; display: inline-block\"><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 1px solid rgb(217, 217, 217); border-bottom: 0px none rgb(33, 33, 33); border-radius: 4px 4px 0px 0px; padding: 6px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace, Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >T = table();<\/span><\/span><\/div><\/div><div class=\"inlineWrapper outputs\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 1px solid rgb(217, 217, 217); border-radius: 0px; padding: 0px 45px 4px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace, Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >T = mdlTable(T,<\/span><span style=\"color: #a709f5;\">'aero_atc'<\/span><span >)<\/span><\/span><\/div><div  style = 'color: rgb(33, 33, 33); padding: 10px 0px 6px 17px; background: rgb(220, 220, 220) none repeat scroll 0% 0% \/ auto padding-box border-box; font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; overflow-x: hidden; line-height: 17.234px; '><div class=\"inlineElement eoOutputWrapper disableDefaultGestureHandling embeddedOutputsVariableTableElement\" uid=\"6E61A511\" prevent-scroll=\"true\" data-testid=\"output_2\" tabindex=\"-1\" style=\"width: calc(100% - 5px);\"><div class=\"ClientDocument veSpecifier table constrictHeight\" id=\"variableeditor_client_Document_0\" widgetid=\"variableeditor_client_Document_0\" tabindex=\"0\" aria-labelledby=\"variableeditor_views_SummaryBar_0\"><div class=\"summaryBar\" style=\"font-size: 12px; font-family: Consolas, Inconsolata, Menlo, monospace;\"><span>T = <\/span><span style=\"color: rgb(179, 179, 179); font-style: normal;\">10\u00d72 table <\/span><\/div><div id=\"variableeditor_TableViewModel_0\" widgetid=\"variableeditor_TableViewModel_0\" class=\"table lightWeightView ClientViewDiv hasSummaryBar\" data-viewid=\"__1\" style=\"width: 100%; overflow: auto;\"><table cellspacing=\"0\" style=\"border-spacing: 0px; border-collapse: collapse;\"><thead><tr><th rowspan=\"2\" style=\"text-overflow: ellipsis; font-family: Arial, sans-serif; font-size: 12px; overflow: hidden; padding: 6px 3px 3px; width: 34px; border: 1px solid rgb(191, 191, 191); text-align: left; background-color: rgb(245, 245, 245); color: rgba(0, 0, 0, 0.75); font-weight: 700; box-sizing: border-box;\"><span>&nbsp;<\/span><\/th><th class=\"groupedHeader1\" colspan=\"2\" style=\"text-overflow: ellipsis; font-family: Arial, sans-serif; font-size: 12px; overflow: hidden; padding: 6px 3px 3px; width: 224px; min-width: 224px; max-width: 224px; border: 1px solid rgb(191, 191, 191); text-align: center; background-color: rgb(245, 245, 245); color: rgba(0, 0, 0, 0.75); font-weight: 700; box-sizing: border-box;\"><span>EndNodes<\/span><\/th><th rowspan=\"2\" style=\"text-overflow: ellipsis; font-family: Arial, sans-serif; font-size: 12px; overflow: hidden; padding: 6px 3px 3px; width: 86px; min-width: 86px; max-width: 86px; border: 1px solid rgb(191, 191, 191); text-align: center; background-color: rgb(245, 245, 245); color: rgba(0, 0, 0, 0.75); font-weight: 700; box-sizing: border-box;\"><span>Weight<\/span><\/th><\/tr><tr><th style=\"text-overflow: ellipsis; font-family: Arial, sans-serif; font-size: 12px; overflow: hidden; padding: 6px 3px 3px; width: 224px; min-width: 224px; max-width: 224px; border: 1px solid rgb(191, 191, 191); text-align: center; background-color: rgb(245, 245, 245); color: rgba(0, 0, 0, 0.75); font-weight: 700; box-sizing: border-box;\"><span>1<\/span><\/th><th style=\"text-overflow: ellipsis; font-family: Arial, sans-serif; font-size: 12px; overflow: hidden; padding: 6px 3px 3px; width: 602px; min-width: 602px; max-width: 602px; border: 1px solid rgb(191, 191, 191); text-align: center; background-color: rgb(245, 245, 245); color: rgba(0, 0, 0, 0.75); font-weight: 700; box-sizing: border-box;\"><span>2<\/span><\/th><\/tr><\/thead><tbody><tr><th style=\"text-overflow: ellipsis; font-family: Arial, sans-serif; font-size: 12px; overflow: hidden; padding: 6px 3px 3px; width: 34px; border-width: 0px 1px 1px; border-style: solid; border-color: rgb(191, 191, 191); border-image: initial; text-align: left; background-color: rgb(245, 245, 245); color: rgba(0, 0, 0, 0.75); font-weight: 700; box-sizing: border-box;\"><span>1<\/span><\/th><td style=\"text-overflow: ellipsis; font-family: Arial, sans-serif; font-size: 12px; overflow: hidden; padding: 3px; width: 224px; min-width: 224px; max-width: 224px; border-width: 0px 1px 1px; border-style: solid; border-color: rgb(191, 191, 191); border-image: initial; text-align: left;\"><span>\"aero_atc\"<\/span><\/td><td style=\"text-overflow: ellipsis; font-family: Arial, sans-serif; font-size: 12px; overflow: hidden; padding: 3px; width: 602px; min-width: 602px; max-width: 602px; border-width: 0px 1px 1px; border-style: solid; border-color: rgb(191, 191, 191); border-image: initial; text-align: left;\"><span>\"aero_atc\/Aircraft\"<\/span><\/td><td style=\"text-overflow: ellipsis; font-family: Arial, sans-serif; font-size: 12px; overflow: hidden; padding: 3px; width: 86px; min-width: 86px; max-width: 86px; border-width: 0px 1px 1px; border-style: solid; border-color: rgb(191, 191, 191); border-image: initial; text-align: right;\"><span>10<\/span><\/td><\/tr><tr><th style=\"text-overflow: ellipsis; font-family: Arial, sans-serif; font-size: 12px; overflow: hidden; padding: 6px 3px 3px; width: 34px; border-width: 0px 1px 1px; border-style: solid; border-color: rgb(191, 191, 191); border-image: initial; text-align: left; background-color: rgb(245, 245, 245); color: rgba(0, 0, 0, 0.75); font-weight: 700; box-sizing: border-box;\"><span>2<\/span><\/th><td style=\"text-overflow: ellipsis; font-family: Arial, sans-serif; font-size: 12px; overflow: hidden; padding: 3px; width: 224px; min-width: 224px; max-width: 224px; border-width: 0px 1px 1px; border-style: solid; border-color: rgb(191, 191, 191); border-image: initial; text-align: left;\"><span>\"aero_atc\"<\/span><\/td><td style=\"text-overflow: ellipsis; font-family: Arial, sans-serif; font-size: 12px; overflow: hidden; padding: 3px; width: 602px; min-width: 602px; max-width: 602px; border-width: 0px 1px 1px; border-style: solid; border-color: rgb(191, 191, 191); border-image: initial; text-align: left;\"><span>\"aero_atc\/More&nbsp;Info\"<\/span><\/td><td style=\"text-overflow: ellipsis; font-family: Arial, sans-serif; font-size: 12px; overflow: hidden; padding: 3px; width: 86px; min-width: 86px; max-width: 86px; border-width: 0px 1px 1px; border-style: solid; border-color: rgb(191, 191, 191); border-image: initial; text-align: right;\"><span>1<\/span><\/td><\/tr><tr><th style=\"text-overflow: ellipsis; font-family: Arial, sans-serif; font-size: 12px; overflow: hidden; padding: 6px 3px 3px; width: 34px; border-width: 0px 1px 1px; border-style: solid; border-color: rgb(191, 191, 191); border-image: initial; text-align: left; background-color: rgb(245, 245, 245); color: rgba(0, 0, 0, 0.75); font-weight: 700; box-sizing: border-box;\"><span>3<\/span><\/th><td style=\"text-overflow: ellipsis; font-family: Arial, sans-serif; font-size: 12px; overflow: hidden; padding: 3px; width: 224px; min-width: 224px; max-width: 224px; border-width: 0px 1px 1px; border-style: solid; border-color: rgb(191, 191, 191); border-image: initial; text-align: left;\"><span>\"aero_atc\"<\/span><\/td><td style=\"text-overflow: ellipsis; font-family: Arial, sans-serif; font-size: 12px; overflow: hidden; padding: 3px; width: 602px; min-width: 602px; max-width: 602px; border-width: 0px 1px 1px; border-style: solid; border-color: rgb(191, 191, 191); border-image: initial; text-align: left;\"><span>\"aero_atc\/Radar\"<\/span><\/td><td style=\"text-overflow: ellipsis; font-family: Arial, sans-serif; font-size: 12px; overflow: hidden; padding: 3px; width: 86px; min-width: 86px; max-width: 86px; border-width: 0px 1px 1px; border-style: solid; border-color: rgb(191, 191, 191); border-image: initial; text-align: right;\"><span>94<\/span><\/td><\/tr><tr><th style=\"text-overflow: ellipsis; font-family: Arial, sans-serif; font-size: 12px; overflow: hidden; padding: 6px 3px 3px; width: 34px; border-width: 0px 1px 1px; border-style: solid; border-color: rgb(191, 191, 191); border-image: initial; text-align: left; background-color: rgb(245, 245, 245); color: rgba(0, 0, 0, 0.75); font-weight: 700; box-sizing: border-box;\"><span>4<\/span><\/th><td style=\"text-overflow: ellipsis; font-family: Arial, sans-serif; font-size: 12px; overflow: hidden; padding: 3px; width: 224px; min-width: 224px; max-width: 224px; border-width: 0px 1px 1px; border-style: solid; border-color: rgb(191, 191, 191); border-image: initial; text-align: left;\"><span>\"aero_atc\/Radar\"<\/span><\/td><td style=\"text-overflow: ellipsis; font-family: Arial, sans-serif; font-size: 12px; overflow: hidden; padding: 3px; width: 602px; min-width: 602px; max-width: 602px; border-width: 0px 1px 1px; border-style: solid; border-color: rgb(191, 191, 191); border-image: initial; text-align: left;\"><span>\"aero_atc\/Radar\/Calculate\u21b5SNR\"<\/span><\/td><td style=\"text-overflow: ellipsis; font-family: Arial, sans-serif; font-size: 12px; overflow: hidden; padding: 3px; width: 86px; min-width: 86px; max-width: 86px; border-width: 0px 1px 1px; border-style: solid; border-color: rgb(191, 191, 191); border-image: initial; text-align: right;\"><span>7<\/span><\/td><\/tr><tr><th style=\"text-overflow: ellipsis; font-family: Arial, sans-serif; font-size: 12px; overflow: hidden; padding: 6px 3px 3px; width: 34px; border-width: 0px 1px 1px; border-style: solid; border-color: rgb(191, 191, 191); border-image: initial; text-align: left; background-color: rgb(245, 245, 245); color: rgba(0, 0, 0, 0.75); font-weight: 700; box-sizing: border-box;\"><span>5<\/span><\/th><td style=\"text-overflow: ellipsis; font-family: Arial, sans-serif; font-size: 12px; overflow: hidden; padding: 3px; width: 224px; min-width: 224px; max-width: 224px; border-width: 0px 1px 1px; border-style: solid; border-color: rgb(191, 191, 191); border-image: initial; text-align: left;\"><span>\"aero_atc\/Radar\"<\/span><\/td><td style=\"text-overflow: ellipsis; font-family: Arial, sans-serif; font-size: 12px; overflow: hidden; padding: 3px; width: 602px; min-width: 602px; max-width: 602px; border-width: 0px 1px 1px; border-style: solid; border-color: rgb(191, 191, 191); border-image: initial; text-align: left;\"><span>\"aero_atc\/Radar\/Calculate&nbsp;Antenna&nbsp;Area\"<\/span><\/td><td style=\"text-overflow: ellipsis; font-family: Arial, sans-serif; font-size: 12px; overflow: hidden; padding: 3px; width: 86px; min-width: 86px; max-width: 86px; border-width: 0px 1px 1px; border-style: solid; border-color: rgb(191, 191, 191); border-image: initial; text-align: right;\"><span>18<\/span><\/td><\/tr><tr><th style=\"text-overflow: ellipsis; font-family: Arial, sans-serif; font-size: 12px; overflow: hidden; padding: 6px 3px 3px; width: 34px; border-width: 0px 1px 1px; border-style: solid; border-color: rgb(191, 191, 191); border-image: initial; text-align: left; background-color: rgb(245, 245, 245); color: rgba(0, 0, 0, 0.75); font-weight: 700; box-sizing: border-box;\"><span>6<\/span><\/th><td style=\"text-overflow: ellipsis; font-family: Arial, sans-serif; font-size: 12px; overflow: hidden; padding: 3px; width: 224px; min-width: 224px; max-width: 224px; border-width: 0px 1px 1px; border-style: solid; border-color: rgb(191, 191, 191); border-image: initial; text-align: left;\"><span>\"aero_atc\/Radar\"<\/span><\/td><td style=\"text-overflow: ellipsis; font-family: Arial, sans-serif; font-size: 12px; overflow: hidden; padding: 3px; width: 602px; min-width: 602px; max-width: 602px; border-width: 0px 1px 1px; border-style: solid; border-color: rgb(191, 191, 191); border-image: initial; text-align: left;\"><span>\"aero_atc\/Radar\/Calculate&nbsp;Antenna&nbsp;Gain\"<\/span><\/td><td style=\"text-overflow: ellipsis; font-family: Arial, sans-serif; font-size: 12px; overflow: hidden; padding: 3px; width: 86px; min-width: 86px; max-width: 86px; border-width: 0px 1px 1px; border-style: solid; border-color: rgb(191, 191, 191); border-image: initial; text-align: right;\"><span>7<\/span><\/td><\/tr><tr><th style=\"text-overflow: ellipsis; font-family: Arial, sans-serif; font-size: 12px; overflow: hidden; padding: 6px 3px 3px; width: 34px; border-width: 0px 1px 1px; border-style: solid; border-color: rgb(191, 191, 191); border-image: initial; text-align: left; background-color: rgb(245, 245, 245); color: rgba(0, 0, 0, 0.75); font-weight: 700; box-sizing: border-box;\"><span>7<\/span><\/th><td style=\"text-overflow: ellipsis; font-family: Arial, sans-serif; font-size: 12px; overflow: hidden; padding: 3px; width: 224px; min-width: 224px; max-width: 224px; border-width: 0px 1px 1px; border-style: solid; border-color: rgb(191, 191, 191); border-image: initial; text-align: left;\"><span>\"aero_atc\/Radar\"<\/span><\/td><td style=\"text-overflow: ellipsis; font-family: Arial, sans-serif; font-size: 12px; overflow: hidden; padding: 3px; width: 602px; min-width: 602px; max-width: 602px; border-width: 0px 1px 1px; border-style: solid; border-color: rgb(191, 191, 191); border-image: initial; text-align: left;\"><span>\"aero_atc\/Radar\/Calculate&nbsp;Noise&nbsp;of&nbsp;Antenna\"<\/span><\/td><td style=\"text-overflow: ellipsis; font-family: Arial, sans-serif; font-size: 12px; overflow: hidden; padding: 3px; width: 86px; min-width: 86px; max-width: 86px; border-width: 0px 1px 1px; border-style: solid; border-color: rgb(191, 191, 191); border-image: initial; text-align: right;\"><span>12<\/span><\/td><\/tr><tr><th style=\"text-overflow: ellipsis; font-family: Arial, sans-serif; font-size: 12px; overflow: hidden; padding: 6px 3px 3px; width: 34px; border-width: 0px 1px 1px; border-style: solid; border-color: rgb(191, 191, 191); border-image: initial; text-align: left; background-color: rgb(245, 245, 245); color: rgba(0, 0, 0, 0.75); font-weight: 700; box-sizing: border-box;\"><span>8<\/span><\/th><td style=\"text-overflow: ellipsis; font-family: Arial, sans-serif; font-size: 12px; overflow: hidden; padding: 3px; width: 224px; min-width: 224px; max-width: 224px; border-width: 0px 1px 1px; border-style: solid; border-color: rgb(191, 191, 191); border-image: initial; text-align: left;\"><span>\"aero_atc\/Radar\"<\/span><\/td><td style=\"text-overflow: ellipsis; font-family: Arial, sans-serif; font-size: 12px; overflow: hidden; padding: 3px; width: 602px; min-width: 602px; max-width: 602px; border-width: 0px 1px 1px; border-style: solid; border-color: rgb(191, 191, 191); border-image: initial; text-align: left;\"><span>\"aero_atc\/Radar\/Check&nbsp;SNR\"<\/span><\/td><td style=\"text-overflow: ellipsis; font-family: Arial, sans-serif; font-size: 12px; overflow: hidden; padding: 3px; width: 86px; min-width: 86px; max-width: 86px; border-width: 0px 1px 1px; border-style: solid; border-color: rgb(191, 191, 191); border-image: initial; text-align: right;\"><span>9<\/span><\/td><\/tr><tr><th style=\"text-overflow: ellipsis; font-family: Arial, sans-serif; font-size: 12px; overflow: hidden; padding: 6px 3px 3px; width: 34px; border-width: 0px 1px 1px; border-style: solid; border-color: rgb(191, 191, 191); border-image: initial; text-align: left; background-color: rgb(245, 245, 245); color: rgba(0, 0, 0, 0.75); font-weight: 700; box-sizing: border-box;\"><span>9<\/span><\/th><td style=\"text-overflow: ellipsis; font-family: Arial, sans-serif; font-size: 12px; overflow: hidden; padding: 3px; width: 224px; min-width: 224px; max-width: 224px; border-width: 0px 1px 1px; border-style: solid; border-color: rgb(191, 191, 191); border-image: initial; text-align: left;\"><span>\"aero_atc\/Radar\"<\/span><\/td><td style=\"text-overflow: ellipsis; font-family: Arial, sans-serif; font-size: 12px; overflow: hidden; padding: 3px; width: 602px; min-width: 602px; max-width: 602px; border-width: 0px 1px 1px; border-style: solid; border-color: rgb(191, 191, 191); border-image: initial; text-align: left;\"><span>\"aero_atc\/Radar\/Estimate&nbsp;Range\"<\/span><\/td><td style=\"text-overflow: ellipsis; font-family: Arial, sans-serif; font-size: 12px; overflow: hidden; padding: 3px; width: 86px; min-width: 86px; max-width: 86px; border-width: 0px 1px 1px; border-style: solid; border-color: rgb(191, 191, 191); border-image: initial; text-align: right;\"><span>11<\/span><\/td><\/tr><tr><th style=\"text-overflow: ellipsis; font-family: Arial, sans-serif; font-size: 12px; overflow: hidden; padding: 6px 3px 3px; width: 34px; border-width: 0px 1px 1px; border-style: solid; border-color: rgb(191, 191, 191); border-image: initial; text-align: left; background-color: rgb(245, 245, 245); color: rgba(0, 0, 0, 0.75); font-weight: 700; box-sizing: border-box;\"><span>10<\/span><\/th><td style=\"text-overflow: ellipsis; font-family: Arial, sans-serif; font-size: 12px; overflow: hidden; padding: 3px; width: 224px; min-width: 224px; max-width: 224px; border-width: 0px 1px 1px; border-style: solid; border-color: rgb(191, 191, 191); border-image: initial; text-align: left;\"><span>\"aero_atc\"<\/span><\/td><td style=\"text-overflow: ellipsis; font-family: Arial, sans-serif; font-size: 12px; overflow: hidden; padding: 3px; width: 602px; min-width: 602px; max-width: 602px; border-width: 0px 1px 1px; border-style: solid; border-color: rgb(191, 191, 191); border-image: initial; text-align: left;\"><span>\"aero_atc\/Weather\"<\/span><\/td><td style=\"text-overflow: ellipsis; font-family: Arial, sans-serif; font-size: 12px; overflow: hidden; padding: 3px; width: 86px; min-width: 86px; max-width: 86px; border-width: 0px 1px 1px; border-style: solid; border-color: rgb(191, 191, 191); border-image: initial; text-align: right;\"><span>17<\/span><\/td><\/tr><\/tbody><\/table><\/div><\/div><div class=\"outputLayer selectedOutputDecorationLayer doNotExport\" aria-hidden=\"true\"><\/div><div class=\"outputLayer activeOutputDecorationLayer doNotExport\" aria-hidden=\"true\"><\/div><div class=\"outputLayer scrollableOutputDecorationLayer doNotExport\" aria-hidden=\"true\"><\/div><div class=\"outputLayer navigationFocusLayer doNotExport\" aria-hidden=\"false\" tabindex=\"-1\" role=\"application\" aria-label=\"variable output starting with T = \n                               EndNodes                                Weight\n    _______________________________________________________________\"><\/div><\/div><\/div><\/div><\/div><h2  style = 'margin: 3px 10px 5px 4px; padding: 0px; line-height: 25px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: 700; text-align: left; '><span>From Table to Sankey<\/span><\/h2><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Once the table is created, I can create the <\/span><span style=' font-family: monospace;'>digraph<\/span><span> and the Sankey diagram:<\/span><\/div><div style=\"background-color: #F5F5F5; margin: 10px 15px 10px 0; display: inline-block\"><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 1px solid rgb(217, 217, 217); border-bottom: 0px none rgb(33, 33, 33); border-radius: 4px 4px 0px 0px; padding: 6px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace, Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >DG = digraph(T);<\/span><\/span><\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace, Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >f = uifigure;<\/span><\/span><\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace, Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >SC = SankeyChart( <\/span><span style=\"color: #a709f5;\">\"Parent\"<\/span><span >, f, <\/span><span style=\"color: #a709f5;\">\"GraphData\"<\/span><span >, DG );<\/span><\/span><\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace, Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >SC.LabelIncludeTotal = <\/span><span style=\"color: #a709f5;\">\"on\"<\/span><span >;<\/span><\/span><\/div><\/div><div class=\"inlineWrapper outputs\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 1px solid rgb(217, 217, 217); border-radius: 0px; padding: 0px 45px 4px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace, Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >SC = fixBlockNames(SC);<\/span><\/span><\/div><\/div><div  style = 'color: rgb(33, 33, 33); padding: 10px 0px 6px 17px; background: rgb(220, 220, 220) none repeat scroll 0% 0% \/ auto padding-box border-box; font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; overflow-x: hidden; line-height: 17.234px; '><div class=\"inlineElement eoOutputWrapper disableDefaultGestureHandling embeddedOutputsFigure\" uid=\"0E91A64C\" prevent-scroll=\"true\" data-testid=\"output_3\" tabindex=\"-1\" ><div class=\"figureElement eoOutputContent\" role=\"article\" aria-roledescription=\"Use Browse Mode to explore \" aria-description=\"figure output \"><img decoding=\"async\" class=\"figureImage figureContainingNode\" src=\"https:\/\/blogs.mathworks.com\/simulink\/files\/SimulinkSankey.mlx-03-28-25_6.png\" style=\"width: 560px;\"><div class=\"outputLayer selectedOutputDecorationLayer doNotExport\" aria-hidden=\"true\"><\/div><div class=\"outputLayer activeOutputDecorationLayer doNotExport\" aria-hidden=\"true\"><\/div><div class=\"outputLayer scrollableOutputDecorationLayer doNotExport\" aria-hidden=\"true\"><\/div><div class=\"outputLayer navigationFocusLayer doNotExport\" aria-hidden=\"false\" tabindex=\"-1\" role=\"application\" aria-label=\"figure output \"><\/div><\/div><\/div><\/div><\/div><div  style = 'margin: 10px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>The last line <\/span><span style=' font-family: monospace;'>fixBlkNames<\/span><span> is a simple function I created to replace the blockpaths with the block names. Using the full blockpath easily becomes large, cluttering the diagram.<\/span><\/div><h2  style = 'margin: 3px 10px 5px 4px; padding: 0px; line-height: 25px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: 700; text-align: left; '><span style=' font-weight: bold;'>Larger Models<\/span><\/h2><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>I tried with a few larger models. This made me realize that many small subsystems with just a few blocks are often cluttering the diagram. So I decided to include a threshold and filter out those small subsystems. Here is my final function:<\/span><\/div><div class = 'preformatted-matlab' style = 'margin: 10px 3px 10px 55px; padding: 10px 10px 10px 5px; '><div  style = 'border-left: 0px none rgb(33, 33, 33); border-right: 0px none rgb(33, 33, 33); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px; line-height: 15.6px; min-height: 16px; white-space: pre; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 12px; '><span style=\"white-space: pre\"><span style=\"color: #0e00ff;\">function <\/span><span >SC = mdlSankey(mdl,lim)<\/span><\/span><\/div><div  style = 'border-left: 0px none rgb(33, 33, 33); border-right: 0px none rgb(33, 33, 33); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px; line-height: 15.6px; min-height: 16px; white-space: pre; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 12px; '><span style=\"white-space: pre\"><span >&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0e00ff;\">arguments<\/span><\/span><\/div><div  style = 'border-left: 0px none rgb(33, 33, 33); border-right: 0px none rgb(33, 33, 33); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px; line-height: 15.6px; min-height: 16px; white-space: pre; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 12px; '><span style=\"white-space: pre\"><span >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mdl <\/span><span style=\"color: #a0522d;\">char<\/span><\/span><\/div><div  style = 'border-left: 0px none rgb(33, 33, 33); border-right: 0px none rgb(33, 33, 33); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px; line-height: 15.6px; min-height: 16px; white-space: pre; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 12px; '><span style=\"white-space: pre\"><span >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;lim <\/span><span style=\"color: #a0522d;\">(1,1) {mustBeNumeric}<\/span><span > = 1;<\/span><\/span><\/div><div  style = 'border-left: 0px none rgb(33, 33, 33); border-right: 0px none rgb(33, 33, 33); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px; line-height: 15.6px; min-height: 16px; white-space: pre; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 12px; '><span style=\"white-space: pre\"><span >&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0e00ff;\">end<\/span><\/span><\/div><div  style = 'border-left: 0px none rgb(33, 33, 33); border-right: 0px none rgb(33, 33, 33); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px; line-height: 15.6px; min-height: 16px; white-space: pre; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 12px; '><span style=\"white-space: pre\"><span >&nbsp;&nbsp;&nbsp;&nbsp;warning(<\/span><span style=\"color: #a709f5;\">'off'<\/span><span >,<\/span><span style=\"color: #a709f5;\">'SankeyChart:UnbalancedGraph'<\/span><span >);<\/span><\/span><\/div><div  style = 'border-left: 0px none rgb(33, 33, 33); border-right: 0px none rgb(33, 33, 33); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px; line-height: 15.6px; min-height: 16px; white-space: pre; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 12px; '><span style=\"white-space: pre\"><span >&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #008013;\">% Fill the table with find_system<\/span><\/span><\/div><div  style = 'border-left: 0px none rgb(33, 33, 33); border-right: 0px none rgb(33, 33, 33); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px; line-height: 15.6px; min-height: 16px; white-space: pre; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 12px; '><span style=\"white-space: pre\"><span >&nbsp;&nbsp;&nbsp;&nbsp;T = mdlTable(table(),mdl);<\/span><\/span><\/div><div  style = 'border-left: 0px none rgb(33, 33, 33); border-right: 0px none rgb(33, 33, 33); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px; line-height: 15.6px; min-height: 16px; white-space: pre; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 12px; '><span style=\"white-space: pre\"><span >&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #008013;\">% Cut elements with less blocks than \"lim\"<\/span><\/span><\/div><div  style = 'border-left: 0px none rgb(33, 33, 33); border-right: 0px none rgb(33, 33, 33); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px; line-height: 15.6px; min-height: 16px; white-space: pre; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 12px; '><span style=\"white-space: pre\"><span >&nbsp;&nbsp;&nbsp;&nbsp;T(T.Weight&lt;lim,:) = [];<\/span><\/span><\/div><div  style = 'border-left: 0px none rgb(33, 33, 33); border-right: 0px none rgb(33, 33, 33); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px; line-height: 15.6px; min-height: 16px; white-space: pre; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 12px; '><span style=\"white-space: pre\"><span >&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #008013;\">% create digraph<\/span><\/span><\/div><div  style = 'border-left: 0px none rgb(33, 33, 33); border-right: 0px none rgb(33, 33, 33); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px; line-height: 15.6px; min-height: 16px; white-space: pre; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 12px; '><span style=\"white-space: pre\"><span >&nbsp;&nbsp;&nbsp;&nbsp;DG = digraph(T);<\/span><\/span><\/div><div  style = 'border-left: 0px none rgb(33, 33, 33); border-right: 0px none rgb(33, 33, 33); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px; line-height: 15.6px; min-height: 16px; white-space: pre; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 12px; '><span style=\"white-space: pre\"><span >&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #008013;\">% Plot<\/span><\/span><\/div><div  style = 'border-left: 0px none rgb(33, 33, 33); border-right: 0px none rgb(33, 33, 33); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px; line-height: 15.6px; min-height: 16px; white-space: pre; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 12px; '><span style=\"white-space: pre\"><span >&nbsp;&nbsp;&nbsp;&nbsp;f = uifigure;<\/span><\/span><\/div><div  style = 'border-left: 0px none rgb(33, 33, 33); border-right: 0px none rgb(33, 33, 33); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px; line-height: 15.6px; min-height: 16px; white-space: pre; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 12px; '><span style=\"white-space: pre\"><span >&nbsp;&nbsp;&nbsp;&nbsp;SC = SankeyChart( <\/span><span style=\"color: #a709f5;\">\"Parent\"<\/span><span >, f, <\/span><span style=\"color: #a709f5;\">\"GraphData\"<\/span><span >, DG );<\/span><\/span><\/div><div  style = 'border-left: 0px none rgb(33, 33, 33); border-right: 0px none rgb(33, 33, 33); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px; line-height: 15.6px; min-height: 16px; white-space: pre; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 12px; '><span style=\"white-space: pre\"><span >&nbsp;&nbsp;&nbsp;&nbsp;SC.LabelIncludeTotal = <\/span><span style=\"color: #a709f5;\">\"on\"<\/span><span >;<\/span><\/span><\/div><div  style = 'border-left: 0px none rgb(33, 33, 33); border-right: 0px none rgb(33, 33, 33); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px; line-height: 15.6px; min-height: 16px; white-space: pre; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 12px; '><span style=\"white-space: pre\"><span >&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #008013;\">% Fix labels<\/span><\/span><\/div><div  style = 'border-left: 0px none rgb(33, 33, 33); border-right: 0px none rgb(33, 33, 33); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px; line-height: 15.6px; min-height: 16px; white-space: pre; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 12px; '><span style=\"white-space: pre\"><span >&nbsp;&nbsp;&nbsp;&nbsp;SC = fixBlockNames(SC);<\/span><\/span><\/div><div  style = 'border-left: 0px none rgb(33, 33, 33); border-right: 0px none rgb(33, 33, 33); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px; line-height: 15.6px; min-height: 16px; white-space: pre; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 12px; '><span style=\"white-space: pre\"><span style=\"color: #0e00ff;\">end<\/span><\/span><\/div><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Here is what it looks like for example <\/span><a href = \"https:\/\/www.mathworks.com\/help\/simulink\/slref\/marine-vessel-collision-avoidance-and-trajectory-tracking.html\"><span>Collision Avoidance and Trajectory Tracking of a Marine Vessel<\/span><\/a><span>, which contains 3680 blocks, with the diagram limited to subsystems with more than 100 blocks:<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><img class = \"imageNode\" src = \"https:\/\/blogs.mathworks.com\/simulink\/files\/SimulinkSankey.mlx-03-28-25_7.png\" width = \"801\" height = \"681\" alt = \"\" style = \"vertical-align: baseline; width: 801px; height: 681px;\"><\/img><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>I tried pushing my luck a bit and plotted the <\/span><a href = \"https:\/\/www.mathworks.com\/help\/vdynblks\/ug\/double-lane-change-reference-application.html\"><span>Double Lane Change Reference Application<\/span><\/a><span> from the <\/span><a href = \"https:\/\/www.mathworks.com\/help\/vdynblks\/index.html\"><span>Vehicle Dynamics Blockset<\/span><\/a><span>, which contains 12,000 blocks. Here is the result with the limit set to 100 blocks:<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><img class = \"imageNode\" src = \"https:\/\/blogs.mathworks.com\/simulink\/files\/SimulinkSankey.mlx-03-28-25_8.png\" width = \"1040\" height = \"932\" alt = \"\" style = \"vertical-align: baseline; width: 1040px; height: 932px;\"><\/img><\/div><h2  style = 'margin: 20px 10px 5px 4px; padding: 0px; line-height: 25px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: 700; text-align: left; '><span>Other Tools<\/span><\/h2><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>While we are on that topic, here is a list of tools included with Simulink to help capturing what is inside a model: <\/span><\/div><ul  style = 'margin: 10px 0px 20px; padding-left: 0px; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-size: 14px; '><li  style = 'margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap; '><a href = \"https:\/\/www.mathworks.com\/help\/slcheck\/ref\/model-maintainability-metrics.html\"><span style=' text-decoration: underline;'>Model Maintainability Metrics<\/span><\/a><span>: Included with Simulink Check, this tool helps you assess your model and other design artifacts with respect to many metrics like size, architecture, and complexity<\/span><\/li><li  style = 'margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap; '><a href = \"https:\/\/www.mathworks.com\/help\/matlab\/ref\/dependencyanalyzer-app.html\"><span>Dependency Analyzer<\/span><\/a><span>: An interactive tool for visualizing the files needed and impacted by a Simulink model.<\/span><\/li><li  style = 'margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap; '><a href = \"https:\/\/www.mathworks.com\/help\/simulink\/slref\/sldiagnostics.html\"><span style=' font-family: monospace;'>sldiagnostics<\/span><\/a><span>: Has a <\/span><span style=' font-family: monospace;'>CountBlocks<\/span><span> option to return the number of blocks for each <\/span><span style=' font-family: monospace;'>BlockType<\/span><span> in a model<\/span><\/li><li  style = 'margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap; '><a href = \"https:\/\/www.mathworks.com\/help\/simulink\/slref\/find_mdlrefs.html\"><span style=' font-family: monospace;'>find_mdlrefs<\/span><\/a><span>: Returns the list of model blocks in a model, and the models they reference<\/span><\/li><li  style = 'margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap; '><a href = \"https:\/\/www.mathworks.com\/help\/simulink\/slref\/simulink.findblocks.html\"><span style=' font-family: monospace;'>Simulink.findBlocks<\/span><\/a><span> and <\/span><a href = \"https:\/\/www.mathworks.com\/help\/simulink\/slref\/simulink.findblocksoftype.html\"><span style=' font-family: monospace;'>Simulink.findBlocksOfType<\/span><\/a><span>: If you need to create a custom tool like I did in this post, that's probably the core API you will need to analyze what is in your model.<\/span><\/li><\/ul><h2  style = 'margin: 20px 10px 5px 4px; padding: 0px; line-height: 25px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: 700; text-align: left; '><span>Now it's your turn<\/span><\/h2><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>The code presented here is obviously in a rough shape, I only spent an hour putting that together. If you think this is useful and worth polishing, or have suggestions for improvements, let me know in the comments below. If you try <\/span><a href = \"https:\/\/github.com\/simulink\/blog\/tree\/main\/2025_03_14_SimulinkSankey\" target=\"_blank\"><span>my code<\/span><\/a><span> with your model and run into issues, also let me know in the comments below.<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span><\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><\/div>\n<br>\n<\/div><script type=\"text\/javascript\">\n{ let css = '.eoOutputWrapper { width: calc(90vw - 10px) !important; } \/* Styling that is common to warnings and errors is in diagnosticOutput.css *\/.embeddedOutputsErrorElement {    min-height: 18px;    max-height: 550px;} .embeddedOutputsErrorElement .diagnosticMessage-errorType {    overflow: auto;} .embeddedOutputsErrorElement.activeOutput .eoOutputContent {    user-select: text;    -webkit-user-select: text;} .embeddedOutputsErrorElement.activeOutput .eoOutputContent button {    user-select: none;    -webkit-user-select: none;} .embeddedOutputsErrorElement .eoOutputContent ::selection {} .embeddedOutputsErrorElement.inlineElement {} .embeddedOutputsErrorElement.rightPaneElement {} \/* Styling that is common to warnings and errors is in diagnosticOutput.css *\/.embeddedOutputsWarningElement {    min-height: 18px;    max-height: 550px;} .embeddedOutputsWarningElement .diagnosticMessage-warningType {    overflow: auto;} .embeddedOutputsWarningElement.activeOutput .eoOutputContent {    user-select: text;    -webkit-user-select: text;} .embeddedOutputsWarningElement .eoOutputContent ::selection {} .embeddedOutputsWarningElement.inlineElement {} .embeddedOutputsWarningElement.rightPaneElement {} \/* Copyright 2015-2023 The MathWorks, Inc. *\/\/* In this file, styles are not scoped to rtcContainer since they could be in the Dojo Tooltip *\/.diagnosticMessage-wrapper {    font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace;    font-size: 12px;} .diagnosticMessage-wrapper.diagnosticMessage-warningType {    \/*This fallback value will be used for appdesigner warnings*\/    color: var(--rtc-warning-output-color, var(--mw-color-matlabWarning));} .diagnosticMessage-wrapper.diagnosticMessage-warningType a {    \/*This fallback value will be used for appdesigner warnings*\/    color: var(--rtc-warning-output-color, var(--mw-color-matlabWarning));    text-decoration: underline;} .rtcThemeDefaultOverride .diagnosticMessage-wrapper.diagnosticMessage-warningType,.rtcThemeDefaultOverride .diagnosticMessage-wrapper.diagnosticMessage-warningType a {    color: var(--mw-color-matlabWarning) !important;} .diagnosticMessage-wrapper.diagnosticMessage-errorType {    \/*This fallback value will be used in appdesigner error tooltip text*\/    color: var(--rtc-error-output-color, var(--mw-color-matlabErrors));} .diagnosticMessage-wrapper.diagnosticMessage-errorType a {    \/*This fallback value will be used in appdesigner error tooltip text*\/    color: var(--rtc-error-output-color, var(--mw-color-matlabErrors));    text-decoration: underline;} .rtcThemeDefaultOverride .diagnosticMessage-wrapper.diagnosticMessage-errorType,.rtcThemeDefaultOverride .diagnosticMessage-wrapper.diagnosticMessage-errorType a {    color: var(--mw-color-matlabErrors) !important;} .diagnosticMessage-wrapper .diagnosticMessage-messagePart,.diagnosticMessage-wrapper .diagnosticMessage-causePart {    white-space: pre-wrap;} .diagnosticMessage-wrapper .diagnosticMessage-stackPart {    white-space: pre;} .embeddedOutputsTextElement,.embeddedOutputsVariableStringElement {    white-space: pre;    word-wrap:  initial;    min-height: 18px;    max-height: 550px;} .embeddedOutputsTextElement .textElement,.embeddedOutputsVariableStringElement .textElement {    overflow: auto;} .embeddedOutputsTextElement.activeOutput .eoOutputContent,.embeddedOutputsVariableStringElement.activeOutput .eoOutputContent {    user-select: text;    -webkit-user-select: text;} \/*embeddedOutputsTextElement has a different dom structure than embeddedOutputsVariableStringElement.Unlike variableString, the text output has both TEXT nodes and elements as children. Hence we needa selector for each.*\/.embeddedOutputsTextElement .eoOutputContent::selection,.embeddedOutputsTextElement .eoOutputContent ::selection,.embeddedOutputsVariableStringElement .eoOutputContent ::selection {} .textElement,.rtcDataTipElement .textElement {    padding-top: 2px;} .embeddedOutputsTextElement.inlineElement,.embeddedOutputsVariableStringElement.inlineElement {} .inlineElement .textElement {} .embeddedOutputsTextElement.rightPaneElement,.embeddedOutputsVariableStringElement.rightPaneElement {    min-height: 16px;} .rightPaneElement .textElement {    padding-top: 2px;    padding-left: 9px;} .embeddedOutputsVariableTableElement .ClientViewDiv  table tr {  height: 22px;  white-space: nowrap;} .embeddedOutputsVariableTableElement .ClientViewDiv  table tr td,.embeddedOutputsVariableTableElement .ClientViewDiv  table tr th {  background-color:white;  text-overflow: ellipsis;  font-family: Arial, sans-serif;  font-size: 12px;  overflow : hidden;} .embeddedOutputsVariableTableElement .ClientViewDiv  table tr span {  text-overflow: ellipsis;  padding: 3px;} .embeddedOutputsVariableTableElement .ClientViewDiv  table tr th {    color: rgba(0,0,0,0.5);  padding: 3px;  font-size: 9px;} \/* ClientDocument has a summary bar child that takes up 17px, this clashes with overflow on the view which allots space for scrollbars. On print preview, this causes headers from <thead> to overlap on subsequent pages. Displaying Document as flex renders summarybar and view in column format and fixes the issue g2788485 *\/.embeddedOutputsVariableTableElement .ClientDocument {  display: flex;  flex-direction: column;}';\nlet head = document.head || document.getElementsByTagName('head')[0];\nlet style = document.createElement('style');\nhead.appendChild(style);\nstyle.type = 'text\/css';\nif (style.styleSheet) {\n    style.styleSheet.cssText = css;\n} else {\n    style.appendChild(document.createTextNode(css));\n}\n\n\n}<\/script>","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img src=\"https:\/\/blogs.mathworks.com\/simulink\/files\/mdl2Sankey.png\" class=\"img-responsive attachment-post-thumbnail size-post-thumbnail wp-post-image\" alt=\"\" decoding=\"async\" loading=\"lazy\" \/><\/div><p>I was recently discussing different ways to visualize the content of a Simulink model with colleagues. Working in technical support, I receive models from users every day and it's always useful to... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/simulink\/2025\/03\/27\/visualizing-the-number-of-blocks-in-a-simulink-model\/\">read more >><\/a><\/p>","protected":false},"author":41,"featured_media":17604,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[121,15,24,128],"tags":[693],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/17598"}],"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=17598"}],"version-history":[{"count":5,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/17598\/revisions"}],"predecessor-version":[{"id":17643,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/17598\/revisions\/17643"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/media\/17604"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/media?parent=17598"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/categories?post=17598"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/tags?post=17598"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}