Compare two files or folders
visdiff(
displays the differences between the two specified files or folders in the
Comparison Tool. The File Comparison Tool supports many file types such as
MATLAB® code files, zip files, MAT-files, and various other MATLAB and Simulink® file formats.name
1,name
2)
Use visdiff
to compare two Simulink models and identify changes or merge differences between the models.
For more information, see Model Comparison (Simulink).
compares two model files and returns a comparison object containing the differences
between the two files. This syntax does not open the Comparison Tool and is only
supported for comparing Simulink models. comparison
=visdiff(___)name
1 and name
2 must
be model files. Use the comparison object to manipulate the comparison at the
command line, for example by applying filters and publishing comparison
reports.
MATLAB Online™ only supports comparing text files and MATLAB code files. Other file types such as zip files, MAT-files, and Simulink models are not currently supported.
In some cases, there might be multiple comparison types available for your selection
(e.g., text, binary, file list, or XML comparison). To select a different comparison
type, use the visdiff
function and specify the
type
argument. You also can select from the available
comparison types in the Comparison Tool. For more information, see Compare Files and Folders and Merge Files.
As an alternative to the visdiff
function, use the Comparison
Tool to compare files or folders interactively. To open the Comparison Tool, go to the
Home tab, and in the File section, click
Compare. Then select the files or folders to compare.
You can also compare a file that is open in the Editor. On the Editor or Live Editor tab, in the File section, select Compare.
To compare a file with the autosave version or the saved version on disk, go to the
Editor tab and click Compare
and select Compare with Version on
Disk or Save and Compare with Autosave. If
your file is modified, the Editor saves the file before comparing. The
Compare with Version on Disk and Save and
Compare with Autosave options are only available if the option for
automatically saving changes to a file is disabled. To disable the option, go to the
Home tab, and in the Environment section,
click Preferences. Then, select
Editor/Debugger and clear Save changes upon
clicking away from a file.
To compare a file or folder in the Current Folder browser, right-click the selected file or folder and select Compare Against. To compare two files or subfolders, right-click the selected files or folders and select Compare Selected Files/Folders.