File Exchange Pick of the Week

Our best user submissions

BusDataStoreComparator

Richard is an Application Engineer at MathWorks focused on the Embedded Coder product for code generation, primarily in the Aerospace industry.

Richard's pick this week is BusDataStoreComparator by Shashikiran Rajashekar.

Pick

My pick this week is the Bus Data Store Comparator.

  • Do you use Bus Objects with your Simulink model?
  • Do you save your Bus Objects in a MAT file?
  • Do you have different versions of the Bus Objects in different files - maybe in a repository?
  • Do you have a need to know what is different between versions of the Bus Objects?

If you answered "yes" to the questions above, then this entry is for you. While MATLAB allows you to compare files and folders, including MAT files, it will only show you the difference for numerical values. If the MAT file contains an item such as a Bus Object, it will only indicate that there is a difference, but not what the difference is. This entry addresses this issue for Bus Objects. The BusDataStoreComparator has a UI that allows the user to specify two MAT files to compare. It then reads the MAT files to extract the Bus Object information, comparing the Bus Elements name, data type and dimensions. The results are presented in the UI with a pass/fail notation indicating if the two items match. In addition, there is an option to save the comparison to an Excel file for archiving. Several examples are included with the BusDataStoreComparator download. Screenshots of these are shown below.

Above you can see the UI for the Bus Data Store Comparator. The user specifies the two MAT files containing Bus Object definitions to compare. Once the comparison is finished as shown in the "Status" field, the results can be displayed via the "Show Results" button. This is shown below. As you can see, the UI diplay the PASS/FAIL for the various bus elements. In this example, the third entry fails due to a difference in the elements dimensions and entries 7 and 8 fail due to differences in the data types. In addition, the Bus Data Store Comparator returns "NOT FOUND" for any elements that do not appear in both files as seen in the last entry.

In addition to basic Bus Objects, the Bus Data Store Comparator handles nested buses too. This can be seen in the picture below where the data type of entries 3 and 4 are Bus Objects.

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 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 the inclusion of all nested buses in the comparison, or a message stating that the definition of the bus is not found in the specified file. This limitation can be seen in the screnshot above where element Example3C.a is of type Bus:Example3B. We get a match because both elements have the same type, but we don't get to see the comparison on the ExampleB Bus Object. This could lead to the user assuming the two bus definitions are equivalent, when there could be a discrepancy in the ExampleB Bus Object.

Comments

All in all, this is a useful tool and provides a great benefit when working in large collaborative environments where multiple users are modifying models and their supporting files. Give it a try and let us know what you think here or leave a comment for Shashikiran.




Published with MATLAB® R2015b

|
  • print

Comments

To leave a comment, please click here to sign in to your MathWorks Account or create a new one.