{"id":7078,"date":"2018-01-31T16:24:42","date_gmt":"2018-01-31T21:24:42","guid":{"rendered":"https:\/\/blogs.mathworks.com\/simulink\/?p=7078"},"modified":"2018-01-31T16:24:42","modified_gmt":"2018-01-31T21:24:42","slug":"whos-calling","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/simulink\/2018\/01\/31\/whos-calling\/","title":{"rendered":"Who&#8217;s Calling?"},"content":{"rendered":"<p>Did you know that it is possible to visualize the calling of Simulink Functions using the <a href=\"https:\/\/www.mathworks.com\/help\/stateflow\/ref\/sequenceviewer.html\">Sequence Viewer<\/a>? Let's see how that works and in what type of situations it can be particularly useful.<\/p>\n<p><strong>The Question<\/strong><\/p>\n<p>Here is a question I have recently been asked:<\/p>\n<p><em>I have a Simulink model with a Simulink Function. The model contains multiple Function CAller blocks that can call this Simulink Function. The Simulink Function contains a MATLAB Function block. When I put a breakpoint in the MATLAB Code, I want to know from which Function Caller block originated the call.<\/em><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/simulink\/2018Q1\/FcnCallProblem.png\" alt=\"Who's calling?\" \/><\/p>\n<p><strong>The Sequence Viewer<\/strong><\/p>\n<p>The answer is a feature I typically use when dealing with SimEvents and Stateflow: The <a href=\"https:\/\/www.mathworks.com\/help\/stateflow\/ug\/what-are-messages.html\">Sequence Viewer<\/a>.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/simulink\/2018Q1\/SevViewerInModel.png\" alt=\"Sequence Viewer\" \/><\/p>\n<p>When the breakpoint in the MATLAB Function block will be hit, you will know that the last client in the list is the one calling. In this image, we are at simulation time t=1sec, and the client is CallerB:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/simulink\/2018Q1\/SequenceViewer.png\" alt=\"Sequence Viewer\" \/><\/p>\n<p><strong>Now it's your turn<\/strong><\/p>\n<p>Are you using the Sequence Viewer in your daily workflow? If yes, tell us why and how in the comments below.<\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img decoding=\"async\"  class=\"img-responsive\" src=\"https:\/\/blogs.mathworks.com\/images\/simulink\/2018Q1\/SequenceViewer.png\" onError=\"this.style.display ='none';\" \/><\/div>\n<p>Did you know that it is possible to visualize the calling of Simulink Functions using the Sequence Viewer? Let's see how that works and in what type of situations it can be particularly useful.<br \/>\nThe... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/simulink\/2018\/01\/31\/whos-calling\/\">read more >><\/a><\/p>\n","protected":false},"author":41,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[33,16],"tags":[516],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/7078"}],"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=7078"}],"version-history":[{"count":13,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/7078\/revisions"}],"predecessor-version":[{"id":7108,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/7078\/revisions\/7108"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/media?parent=7078"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/categories?post=7078"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/tags?post=7078"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}