| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → MATLAB |
| Contents | Index |
| Learn more about MATLAB |
As an alternative to the visdiff function:
Select Desktop > File and Folder Comparisons.
In the File and Folder Comparisons tool select one of the following:
File > New File Comparison
File > New Folder Comparison
visdiff('fname1', 'fname2')
visdiff('fname1', 'fname2', showchars)
S = visdiff('fname1', 'fname2')
visdiff('fname1', 'fname2') opens the File and Folder Comparisons tool and presents the differences between the two files. The two files must be on the MATLAB path, or you must provide the full path for each file.
visdiff('fname1', 'fname2', showchars) opens the File and Folder Comparisons tool with the width of each column in the display set to showchars characters wide. MATLAB ignores the showchars option when you compare two binary files or two MAT-Files.
S = visdiff('fname1', 'fname2') creates an HTML report describing the differences between the two files and returns it in the string S.
MATLAB supports displaying the differences in the File and Folder Comparisons tool only if Java software is installed. However, MATLAB supports assigning the HTML report to a string, even if the Java software is not installed.
Compare the example files, lengthofline.m and lengthofline2.m and set the width of each column to 50 characters wide. :
visdiff(fullfile(matlabroot,'help','techdoc','matlab_env',... 'examples','lengthofline.m'), fullfile(matlabroot,'help',... 'techdoc','matlab_env','examples','lengthofline2.m'), 50)

Compare two binary files that are on the MATLAB path.
visdiff(fullfile(matlabroot,'toolbox','matlab','demos','gatlin.mat'), ... fullfile(matlabroot,'toolbox','matlab','demos','gatlin2.mat'))

Add the folder containing two MEX-files to the MATLAB path, and then compare the files, by issuing these commands:
addpath([matlabroot '\extern\examples\shrlib'])
visdiff('shrlibsample.mexw32', 'yprime.mexw32')The File and Folder Comparisons tool opens and indicates that the files are different, but does not provide details about the differences.

![]() | viewmtx | volumebounds | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |