Thread Subject: Compare files in MATLAB

Subject: Compare files in MATLAB

From: Huy

Date: 23 Dec, 2007 19:04:31

Message: 1 of 5

In MATLAB 2007b, file comparisons could be done by the
following code

desktop = com.mathworks.mde.desk.MLDesktop.getInstance;
desktop.showGroup('File Comparisons',1)

Then select two files.

Thanks Yair Altman,


Anh Huy Phan

RIKEN - BSI

Subject: Compare files in MATLAB

From: Yair Altman

Date: 23 Dec, 2007 21:04:21

Message: 2 of 5

"Huy " <phananhhuy@mathworks.com> wrote in message
<fkmbfv$4h4$1@fred.mathworks.com>...
> In MATLAB 2007b, file comparisons could be done by the
> following code
>
> desktop = com.mathworks.mde.desk.MLDesktop.getInstance;
> desktop.showGroup('File Comparisons',1)
>
> Then select two files.
>
> Thanks Yair Altman,
>
>
> Anh Huy Phan
>
> RIKEN - BSI


Much obliged... :-)

Here's a bonus, since you seem interested in this: You can
programatically set the compared files as follows:
com.mathworks.mde.difftool.DiffReportGroup.getInstance.showFileDiff(filePathLeft,filePathRight,numColumns);
Now you don't need to manually select anything.

The related function
showUnsavedChangesDiff(filePathLeft,textString,numColumns)
compares the contents of disk file filePathLeft with
textString (typically the unsaved version of the same file).

There's also a related showHTMLReport(file1,file2) function.

Of course, these functions are highly prone to change in
future Matlab versions, since they're way deep in
undocumented territory.

Enjoy!

Yair Altman
http://ymasoftware.com

Subject: Compare files in MATLAB

From: Huy

Date: 25 Dec, 2007 04:30:08

Message: 3 of 5

"Yair Altman" <altmanyDEL@gmailDEL.comDEL> wrote in message
<fkmigl$24k$1@fred.mathworks.com>...
> "Huy " <phananhhuy@mathworks.com> wrote in message
> <fkmbfv$4h4$1@fred.mathworks.com>...
> > In MATLAB 2007b, file comparisons could be done by the
> > following code
> >
> > desktop = com.mathworks.mde.desk.MLDesktop.getInstance;
> > desktop.showGroup('File Comparisons',1)
> >
> > Then select two files.
> >
> > Thanks Yair Altman,
> >
> >
> > Anh Huy Phan
> >
> > RIKEN - BSI
>
>
> Much obliged... :-)
>
> Here's a bonus, since you seem interested in this: You can
> programatically set the compared files as follows:
>
com.mathworks.mde.difftool.DiffReportGroup.getInstance.showFileDiff(filePathLeft,filePathRight,numColumns);
> Now you don't need to manually select anything.
>
> The related function
> showUnsavedChangesDiff(filePathLeft,textString,numColumns)
> compares the contents of disk file filePathLeft with
> textString (typically the unsaved version of the same file).
>
> There's also a related showHTMLReport(file1,file2) function.
>
> Of course, these functions are highly prone to change in
> future Matlab versions, since they're way deep in
> undocumented territory.
>
> Enjoy!
>
> Yair Altman
> http://ymasoftware.com


Yair Altman, You're really professional!!!

Thanks!

Subject: Compare files in MATLAB

From: Ken Orr

Date: 4 Jan, 2008 16:19:11

Message: 4 of 5

Yair Altman wrote:
> "Huy " <phananhhuy@mathworks.com> wrote in message
> <fkmbfv$4h4$1@fred.mathworks.com>...
>> In MATLAB 2007b, file comparisons could be done by the
>> following code
>>
>> desktop = com.mathworks.mde.desk.MLDesktop.getInstance;
>> desktop.showGroup('File Comparisons',1)
>>
>> Then select two files.
>>
>> Thanks Yair Altman,
>>
>>
>> Anh Huy Phan
>>
>> RIKEN - BSI
>
>
> Much obliged... :-)
>
> Here's a bonus, since you seem interested in this: You can
> programatically set the compared files as follows:
> com.mathworks.mde.difftool.DiffReportGroup.getInstance.showFileDiff(filePathLeft,filePathRight,numColumns);
> Now you don't need to manually select anything.
>
> The related function
> showUnsavedChangesDiff(filePathLeft,textString,numColumns)
> compares the contents of disk file filePathLeft with
> textString (typically the unsaved version of the same file).
>
> There's also a related showHTMLReport(file1,file2) function.
>
> Of course, these functions are highly prone to change in
> future Matlab versions, since they're way deep in
> undocumented territory.
>
> Enjoy!
>
> Yair Altman
> http://ymasoftware.com

Great point Yair! It would certainly be useful to call the diff tool
programatically. I've created an enhancement request for this.

-Ken

Subject: Compare files in MATLAB

From: Ken Orr

Date: 4 Jan, 2008 16:50:49

Message: 5 of 5

Ken Orr wrote:
> Yair Altman wrote:
>> "Huy " <phananhhuy@mathworks.com> wrote in message
>> <fkmbfv$4h4$1@fred.mathworks.com>...
>>> In MATLAB 2007b, file comparisons could be done by the following code
>>>
>>> desktop = com.mathworks.mde.desk.MLDesktop.getInstance;
>>> desktop.showGroup('File Comparisons',1)
>>>
>>> Then select two files.
>>>
>>> Thanks Yair Altman,
>>>
>>>
>>> Anh Huy Phan
>>>
>>> RIKEN - BSI
>>
>>
>> Much obliged... :-)
>>
>> Here's a bonus, since you seem interested in this: You can
>> programatically set the compared files as follows:
>> com.mathworks.mde.difftool.DiffReportGroup.getInstance.showFileDiff(filePathLeft,filePathRight,numColumns);
>>
>> Now you don't need to manually select anything.
>>
>> The related function
>> showUnsavedChangesDiff(filePathLeft,textString,numColumns)
>> compares the contents of disk file filePathLeft with
>> textString (typically the unsaved version of the same file).
>>
>> There's also a related showHTMLReport(file1,file2) function.
>>
>> Of course, these functions are highly prone to change in
>> future Matlab versions, since they're way deep in
>> undocumented territory.
>>
>> Enjoy!
>>
>> Yair Altman
>> http://ymasoftware.com
>
> Great point Yair! It would certainly be useful to call the diff tool
> programatically. I've created an enhancement request for this.
>
> -Ken

It turns out there is an undocumented function that will do part of what
your asking for. visdiff will open up the diff tool for two files. It
only takes file names as input right now.

As always, note that this is an undocumented function, so itÂ’s
availability and signature may change in the future.

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
file comparisons Anh Huy Phan 23 Dec, 2007 14:04:57
undocumented Anh Huy Phan 23 Dec, 2007 14:04:57
rssFeed for this Thread

Public Submission Policy

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.

Contact us at files@mathworks.com