{"id":492,"date":"2011-10-03T13:37:14","date_gmt":"2011-10-03T13:37:14","guid":{"rendered":"https:\/\/blogs.mathworks.com\/desktop\/2011\/10\/03\/comparison-tool-updates-in-r2011b\/"},"modified":"2011-10-03T13:37:14","modified_gmt":"2011-10-03T13:37:14","slug":"comparison-tool-updates-in-r2011b","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/community\/2011\/10\/03\/comparison-tool-updates-in-r2011b\/","title":{"rendered":"Comparison Tool Updates in R2011b"},"content":{"rendered":"<p><em>This week I\u2019d like to welcome back guest poster, Malcolm Wood, to describe the enhancements to the File and Folder Comparison tool.<\/em><\/p>\n<p>Over the last few releases we have made some major enhancements to the <a href=\"https:\/\/www.mathworks.com\/test\/stuartm\/brokenlinks\/ignore.html?type=ArchiveDoc\">Comparison Tool<\/a> in MATLAB, giving you more flexibility over what you can compare, more detail about the differences, and in some cases the ability to merge changes from one file to another.<\/p>\n<p>In <a href=\"https:\/\/blogs.mathworks.com\/community\/2010\/03\/29\/file-and-folder-comparison-updates-in-r2010a\">previous releases<\/a> you could compare folders with other folders, ZIP-files with other ZIP-files, and <a href=\"https:\/\/www.mathworks.com\/test\/stuartm\/brokenlinks\/ignore.html?type=ArchiveDoc#brbi0gs\">Simulink manifest files<\/a> with other Simulink manifest files.  But since R2010b you can compare any of these with any other, treating each as a container for a list of files.  So if you created a back-up of your work in a ZIP-file one day, you can use the Comparison Tool to examine the differences between the back-up and the folder containing your current work:<\/p>\n<div align=\"center\">\n<img decoding=\"async\" border=\"0\" src=\"https:\/\/blogs.mathworks.com\/images\/desktop\/malcolm_wood_comparison_r2011b\/backup_folder.png\" alt=\"Comparison of backup folder\" width=550>\n<\/div>\n<p>In R2011a we implemented some improvements to the MAT-file comparison report.  It now shows the data types and sizes of your variables, and there\u2019s the option to \u201cmerge\u201d the differences between the files (1), i.e. to copy a variable from one file to the other.  Be careful with this, because there\u2019s no easily accessible \u201cundo\u201d feature for MAT-file merge.  Instead, a back-up file is created to help you in case you make a mistake, and the report includes instructions on how to recover the previous values (2).<\/p>\n<div align=\"center\">\n<img decoding=\"async\" border=\"0\" src=\"https:\/\/blogs.mathworks.com\/images\/desktop\/malcolm_wood_comparison_r2011b\/backup_mat.png\" alt=\"Comparison of backup MAT file\" width=550>\n<\/div>\n<p>The other major new capability here is the option to compare the contents of the variables.  Clicking the little magnifying glass icon (3) opens the \u201cVariable Comparison\u201d window.  There are several different views, depending on the data type.  Here is how it looks for a structure:<\/p>\n<div align=\"center\">\n<img decoding=\"async\" border=\"0\" src=\"https:\/\/blogs.mathworks.com\/images\/desktop\/malcolm_wood_comparison_r2011b\/compare_variable_contents.png\" alt=\"Comparison of variable contents\" width=550>\n<\/div>\n<p>And by double clicking on a field in the structure you can compare the values inside.  This is how it looks for the \u201chand2\u201d field, which is a numeric array:<\/p>\n<div align=\"center\">\n<img decoding=\"async\" border=\"0\" src=\"https:\/\/blogs.mathworks.com\/images\/desktop\/malcolm_wood_comparison_r2011b\/compare_numeric_array.png\" alt=\"Comparison of a numeric array\" width=550>\n<\/div>\n<p>We have also introduced some features to make it easier to concentrate on the important changes between text files.  In R2010b we made it possible to ignore differences that involve only the number of \u201cwhitespace characters\u201d in a line or between lines (4).  So if all you did was change the indentation in your MATLAB code, these won\u2019t show up as differences, leaving you to focus on changes which actually matter to your results.  And in R2011a we made it possible to hide sections of the file which contain no changes (5), saving you a lot of scrolling if you are looking at only a few changes among thousands of lines of text.<\/p>\n<div align=\"center\">\n<img decoding=\"async\" border=\"0\" src=\"https:\/\/blogs.mathworks.com\/images\/desktop\/malcolm_wood_comparison_r2011b\/compare_hide_sections.png\" alt=\"Comparison of text files, hiding sections\" width=550>\n<\/div>\n<p>Those of you who work on both Windows machines and Linux or Unix machines may be familiar with the problem of trying to compare files which use different types of end-of-line character.  Some differencing tools will show every line as different, making it impossible to see where the actual text has changed.  Others will ignore the end-of-line characters, perhaps leaving you scratching your head as to why two files of different sizes are reported as being identical by your differencing tool.<\/p>\n<p>In R2011b we have two features to help you.  Firstly, when comparing files as text and finding no differences to display, MATLAB will also check the sizes of the files and include the result in the report (6).<\/p>\n<div align=\"center\">\n<img decoding=\"async\" border=\"0\" src=\"https:\/\/blogs.mathworks.com\/images\/desktop\/malcolm_wood_comparison_r2011b\/compare_no_differences.png\" alt=\"Comparison of text files, detailed report\" width=550>\n<\/div>\n<p>Secondly, we enhanced the \u201cBinary Comparison\u201d report so that it can show the individual bytes that are different.  By clicking the \u201cNew Comparison\u201d button (7) and choosing \u201cBinary Comparison\u201d in the dialog you can generate a report like this one which enables you to see the additional carriage-return bytes (8):<\/p>\n<div align=\"center\">\n<img decoding=\"async\" border=\"0\" src=\"https:\/\/blogs.mathworks.com\/images\/desktop\/malcolm_wood_comparison_r2011b\/binary_comparison.png\" alt=\"Comparison of binary files\" width=550>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>This week I\u2019d like to welcome back guest poster, Malcolm Wood, to describe the enhancements to the File and Folder Comparison tool.<br \/>\nOver the last few releases we have made some major enhancements to&#8230; <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/community\/2011\/10\/03\/comparison-tool-updates-in-r2011b\/\">read more >><\/a><\/p>\n","protected":false},"author":38,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[4],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/posts\/492"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/users\/38"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/comments?post=492"}],"version-history":[{"count":0,"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/posts\/492\/revisions"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/media?parent=492"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/categories?post=492"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/tags?post=492"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}