{"id":6213,"date":"2015-10-02T08:58:55","date_gmt":"2015-10-02T12:58:55","guid":{"rendered":"https:\/\/blogs.mathworks.com\/pick\/?p=6213"},"modified":"2016-12-23T09:29:51","modified_gmt":"2016-12-23T14:29:51","slug":"busdatastorecomparator","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/pick\/2015\/10\/02\/busdatastorecomparator\/","title":{"rendered":"BusDataStoreComparator"},"content":{"rendered":"<div xmlns:mwsh=\"https:\/\/www.mathworks.com\/namespace\/mcode\/v1\/syntaxhighlight.dtd\" class=\"content\">\r\n   <introduction>\r\n      \r\n      <p><i>Richard is an Application Engineer at MathWorks focused on the Embedded Coder product for code generation, primarily in the\r\n            Aerospace industry.<\/i><\/p>\r\n      <p><a href=\"https:\/\/www.mathworks.com\/matlabcentral\/profile\/authors\/1016860-richard-ruff\">Richard<\/a>'s pick this week is <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/53-shift-busdatastorecomparator\">BusDataStoreComparator<\/a> by <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/profile\/authors\/3656364-shashikiran-rajashekar\">Shashikiran Rajashekar<\/a>.\r\n      <\/p>\r\n   <\/introduction>\r\n\r\n   <h3>Pick<a name=\"1\"><\/a><\/h3>\r\n   <p>My pick this week is the <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/53-shift-busdatastorecomparator\">Bus Data Store Comparator<\/a>.\r\n   <\/p>\r\n   <div>\r\n      <ul>\r\n         <li>Do you use Bus Objects with your Simulink model?<\/li>\r\n         <li>Do you save your Bus Objects in a MAT file?<\/li>\r\n         <li>Do you have different versions of the Bus Objects in different files - maybe in a repository?<\/li>\r\n         <li>Do you have a need to know what is different between versions of the Bus Objects?<\/li>\r\n      <\/ul>\r\n   <\/div>\r\n   <p>If you answered \"yes\" to the questions above, then this entry is for you. While MATLAB allows you to compare files and folders,\r\n      including MAT files, it will only show you the difference for numerical values.  If the MAT file contains an item such as\r\n      a Bus Object, it will only indicate that there is a difference, but not what the difference is.  This entry addresses this\r\n      issue for Bus Objects. The BusDataStoreComparator has a UI that allows the user to specify two MAT files to compare.  It then\r\n      reads the MAT files to extract the Bus Object information, comparing the Bus Elements name, data type and dimensions.  The\r\n      results are presented in the UI with a pass\/fail notation indicating if the two items match.  In addition, there is an option\r\n      to save the comparison to an Excel file for archiving. Several examples are included with the BusDataStoreComparator download.\r\n       Screenshots of these are shown below.\r\n   <\/p>\r\n   <p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/pick\/Sean\/main_BusDataStoreComparator\/BusDataStoreComparator.png\"> <\/p>\r\n   <p>Above you can see the UI for the Bus Data Store Comparator.  The user specifies the two MAT files containing Bus Object definitions\r\n      to compare. Once the comparison is finished as shown in the \"Status\" field, the results can be displayed via the \"Show Results\"\r\n      button. This is shown below.  As you can see, the UI diplay the PASS\/FAIL for the various bus elements.  In this example,\r\n      the third entry fails due to a difference in the elements dimensions and entries 7 and 8 fail due to differences in the data\r\n      types.  In addition,  the Bus Data Store Comparator returns \"NOT FOUND\" for any elements that do not appear in both files\r\n      as seen in the last entry.\r\n   <\/p>\r\n   <p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/pick\/Sean\/main_BusDataStoreComparator\/BusDataStoreComparatorResults1.png\"> <\/p>\r\n   <p>In addition to basic Bus Objects, the Bus Data Store Comparator handles nested buses too.  This can be seen in the picture\r\n      below where the data type of entries 3 and 4 are Bus Objects.\r\n   <\/p>\r\n   <p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/pick\/Sean\/main_BusDataStoreComparator\/BusDataStoreComparatorResults2.png\"> <\/p>\r\n   <p>There are a few enhancements I would like to see be made to the tool. First, the \"Status\" bar is not cleared if the user selects\r\n      a new file. this is a minor issue, but should be relatively easy to fix.  The other item I would like to see addressed is\r\n      the inclusion of all nested buses in the comparison, or a message stating that the definition of the bus is not found in the\r\n      specified file.  This limitation can be seen in the screnshot above where element Example3C.a is of type Bus:Example3B.  We\r\n      get a match because both elements have the same type, but we don't get to see the comparison on the ExampleB Bus Object. \r\n      This could lead to the user assuming the two bus definitions are equivalent, when there could be a discrepancy in the ExampleB\r\n      Bus Object.\r\n   <\/p>\r\n   <h3>Comments<a name=\"5\"><\/a><\/h3>\r\n   <p>All in all, this is a useful tool and provides a great benefit when working in large collaborative environments where multiple\r\n      users are modifying models and their supporting files.  Give it a try and let us know what you think <a href=\"https:\/\/blogs.mathworks.com\/pick\/?p=6213#respond\">here<\/a> or leave a <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/53-shift#comments\">comment<\/a> for Shashikiran.\r\n   <\/p><script language=\"JavaScript\">\r\n<!--\r\n\r\n    function grabCode_d56e72429ca74a718d71b773cfa05d02() {\r\n        \/\/ Remember the title so we can use it in the new page\r\n        title = document.title;\r\n\r\n        \/\/ Break up these strings so that their presence\r\n        \/\/ in the Javascript doesn't mess up the search for\r\n        \/\/ the MATLAB code.\r\n        t1='d56e72429ca74a718d71b773cfa05d02 ' + '##### ' + 'SOURCE BEGIN' + ' #####';\r\n        t2='##### ' + 'SOURCE END' + ' #####' + ' d56e72429ca74a718d71b773cfa05d02';\r\n    \r\n        b=document.getElementsByTagName('body')[0];\r\n        i1=b.innerHTML.indexOf(t1)+t1.length;\r\n        i2=b.innerHTML.indexOf(t2);\r\n \r\n        code_string = b.innerHTML.substring(i1, i2);\r\n        code_string = code_string.replace(\/REPLACE_WITH_DASH_DASH\/g,'--');\r\n\r\n        \/\/ Use \/x3C\/g instead of the less-than character to avoid errors \r\n        \/\/ in the XML parser.\r\n        \/\/ Use '\\x26#60;' instead of '<' so that the XML parser\r\n        \/\/ doesn't go ahead and substitute the less-than character. \r\n        code_string = code_string.replace(\/\\x3C\/g, '\\x26#60;');\r\n\r\n        author = 'Richard Ruff';\r\n        copyright = 'Copyright 2015 The MathWorks, Inc.';\r\n\r\n        w = window.open();\r\n        d = w.document;\r\n        d.write('<pre>\\n');\r\n        d.write(code_string);\r\n\r\n        \/\/ Add author and copyright lines at the bottom if specified.\r\n        if ((author.length > 0) || (copyright.length > 0)) {\r\n            d.writeln('');\r\n            d.writeln('%%');\r\n            if (author.length > 0) {\r\n                d.writeln('% _' + author + '_');\r\n            }\r\n            if (copyright.length > 0) {\r\n                d.writeln('% _' + copyright + '_');\r\n            }\r\n        }\r\n\r\n        d.write('<\/pre>\\n');\r\n      \r\n      d.title = title + ' (MATLAB code)';\r\n      d.close();\r\n      }   \r\n      \r\n-->\r\n<\/script><p style=\"text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray\"><br><a href=\"javascript:grabCode_d56e72429ca74a718d71b773cfa05d02()\"><span style=\"font-size: x-small;        font-style: italic;\">Get \r\n            the MATLAB code \r\n            <noscript>(requires JavaScript)<\/noscript><\/span><\/a><br><br>\r\n      Published with MATLAB&reg; R2015b<br><\/p>\r\n<\/div>\r\n<!--\r\nd56e72429ca74a718d71b773cfa05d02 ##### SOURCE BEGIN #####\r\n%% BusObjectBusCreator\r\n%\r\n% Posted by *Richard Ruff* , October 2, 2015\r\n%\r\n% _Richard is an Application Engineer at MathWorks focused on the Embedded\r\n% Coder product for code generation, primarily in the Aerospace industry._\r\n% \r\n% <https:\/\/www.mathworks.com\/matlabcentral\/profile\/authors\/1016860-richard-ruff\r\n% Richard's> pick this week is\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/53-shift-busdatastorecomparator BusDataStoreComparator> by\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/profile\/authors\/3656364-shashikiran-rajashekar\r\n% Shashikiran Rajashekar>.\r\n% \r\n%% Pick\r\n% My pick this week is the \r\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/53-shift-busdatastorecomparator Bus Data Store Comparator>.\r\n% \r\n% \r\n% * Do you use Bus Objects with your Simulink model?\r\n% * Do you save your Bus Objects in a MAT file?\r\n% * Do you have different versions of the Bus Objects in different files - maybe in a repository?\r\n% * Do you have a need to know what is different between versions of the Bus Objects?\r\n% \r\n% If you answered \"yes\" to the questions above, then this entry is for you.\r\n% While MATLAB allows you to compare files and folders, including MAT\r\n% files, it will only show you the difference for numerical values.  If the\r\n% MAT file contains an item such as a Bus Object, it will only indicate\r\n% that there is a difference, but not what the difference is.  This entry\r\n% addresses this issue for Bus Objects. The BusDataStoreComparator has a UI\r\n% that allows the user to specify two MAT files to compare.  It then reads\r\n% the MAT files to extract the Bus Object information, comparing the Bus\r\n% Elements name, data type and dimensions.  The results are presented in\r\n% the UI with a pass\/fail notation indicating if the two items match.  In\r\n% addition, there is an option to save the comparison to an Excel file for\r\n% archiving. Several examples are included with the BusDataStoreComparator\r\n% download.  Screenshots of these are shown below.\r\n%\r\n% <<BusDataStoreComparator.png>>\r\n\r\n%%\r\n% Above you can see the UI for the Bus Data Store Comparator.  The user\r\n% specifies the two MAT files containing Bus Object definitions to compare.\r\n% Once the comparison is finished as shown in the \"Status\" field, the\r\n% results can be displayed via the \"Show Results\" button. This is shown\r\n% below.  As you can see, the UI diplay the PASS\/FAIL for the various bus\r\n% elements.  In this example, the third entry fails due to a difference in\r\n% the elements dimensions and entries 7 and 8 fail due to differences in\r\n% the data types.  In addition,  the Bus Data Store Comparator returns \"NOT\r\n% FOUND\" for any elements that do not appear in both files as seen in the\r\n% last entry.\r\n%\r\n% <<BusDataStoreComparatorResults1.png>>\r\n\r\n%%\r\n% In addition to basic Bus Objects, the Bus Data Store Comparator handles\r\n% nested buses too.  This can be seen in the picture below where the data\r\n% type of entries 3 and 4 are Bus Objects.\r\n%\r\n% <<BusDataStoreComparatorResults2.png>>\r\n\r\n%%\r\n% There are a few enhancements I would like to see be made to the tool.\r\n% First, the \"Status\" bar is not cleared if the user selects a new file.\r\n% this is a minor issue, but should be relatively easy to fix.  The other\r\n% item I would like to see addressed is the inclusion of all nested buses\r\n% in the comparison, or a message stating that the definition of the bus is\r\n% not found in the specified file.  This limitation can be seen in the\r\n% screnshot above where element Example3C.a is of type Bus:Example3B.  We\r\n% get a match because both elements have the same type, but we don't get to\r\n% see the comparison on the ExampleB Bus Object.  This could lead to the\r\n% user assuming the two bus definitions are equivalent, when there could be\r\n% a discrepancy in the ExampleB Bus Object.\r\n\r\n%% Comments\r\n% \r\n% All in all, this is a useful tool and provides a great benefit when\r\n% working in large collaborative environments where multiple users are\r\n% modifying models and their supporting files.  Give it a try and let us\r\n% know what you think\r\n% <https:\/\/blogs.mathworks.com\/pick\/?p=6213#respond here> or leave a\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/53-shift#comments\r\n% comment> for Shashikiran.\r\n%\r\n \r\n\r\n##### SOURCE END ##### d56e72429ca74a718d71b773cfa05d02\r\n-->","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img decoding=\"async\"  class=\"img-responsive\" src=\"https:\/\/blogs.mathworks.com\/images\/pick\/Sean\/main_BusDataStoreComparator\/BusDataStoreComparator.png\" onError=\"this.style.display ='none';\" \/><\/div><p>\r\n   \r\n      \r\n      Richard is an Application Engineer at MathWorks focused on the Embedded Coder product for code generation, primarily in the\r\n            Aerospace industry.\r\n  ... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/pick\/2015\/10\/02\/busdatastorecomparator\/\">read more >><\/a><\/p>","protected":false},"author":36,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[16],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/6213"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/users\/36"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/comments?post=6213"}],"version-history":[{"count":4,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/6213\/revisions"}],"predecessor-version":[{"id":8218,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/6213\/revisions\/8218"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/media?parent=6213"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/categories?post=6213"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/tags?post=6213"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}