MATLAB社区

MATLAB,社区等

比较工具Updates in R2011b

This week I’d like to welcome back guest poster, Malcolm Wood, to describe the enhancements to the File and Folder Comparison tool.

在过去的几个版本中,我们对比较工具在MATLAB中,为您提供了更大的灵活性,可以比较什么,有关差异的更多详细信息,在某些情况下可以合并从一个文件到另一个文件的更改的能力。

previous releasesyou could compare folders with other folders, ZIP-files with other ZIP-files, and金宝appSimulink清单文件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:

备份文件夹的比较

在R2011a we implemented some improvements to the MAT-file comparison report. It now shows the data types and sizes of your variables, and there’s the option to “merge” the differences between the files (1), i.e. to copy a variable from one file to the other. Be careful with this, because there’s no easily accessible “undo” 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).

备份垫文件的比较

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 “Variable Comparison” window. There are several different views, depending on the data type. Here is how it looks for a structure:

可变内容物的比较

And by double clicking on a field in the structure you can compare the values inside. This is how it looks for the “hand2” field, which is a numeric array:

数字阵列的比较

我们还引入了一些功能,以使更容易专注于文本文件之间的重要更改。在R2010B中,我们使忽略仅涉及一行或线之间的“空格字符”数量的差异(4)。因此,如果您所做的只是更改MATLAB代码中的凹痕,则这些缩进不会显示为差异,使您专注于实际上对结果至关重要的更改。在R2011a中,我们可以隐藏不包含更改的文件的部分(5),如果您在数千行文本中仅查看一些更改,可以为您节省很多滚动。

比较文本文件,隐藏部分

那些在Windows机器和Linux或Unix机器上工作的人可能熟悉试图比较使用不同类型的终端字符的文件的问题。某些差异工具将显示每条线不同,从而使实际文本的变化位置不可能。其他人会忽略终点字符,也许让您挠头,说明为什么两个不同尺寸的文件被报告为不同的工具相同。

在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).

比较文本文件,详细报告

Secondly, we enhanced the “Binary Comparison” report so that it can show the individual bytes that are different. By clicking the “New Comparison” button (7) and choosing “Binary Comparison” in the dialog you can generate a report like this one which enables you to see the additional carriage-return bytes (8):

Comparison of binary files
|
  • print
  • send email

评论

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