Thread Subject: [File Comparison Report][File Difference] output

Subject: [File Comparison Report][File Difference] output

From: Michael Robbins

Date: 19 Jun, 2005 19:58:33

Message: 1 of 2

I'd like to do a little work with the output of a file comparison
program. MATLAB's version is called "File Comparison Report" and it
makes something labeled "File Difference."

An aside here, TMW should call them both the same name.

Anyway... I want to take the data and do some automated parsing on
it. I'd like a list of changed lines, words, etc. Ideally, a
structure like the one PROFILE makes would be great!

If I could get output from a differencing program, like File
Comparison Report, I could use it. I guess I could parse the "File
Difference" screen since it has pretty convenient output. The line
numbers are there and the columns have '<', '>', '.' and 'x' to
identify the comparison--which is all I really need to identify the
lines in question. Unfortunately, the lines are truncated which means
I'd have to go to the original files and look up the actual text.

It's doable and I will do it if I don't find an easier, better, or
already-done solution.

Any ideas are welcome.

TIA

Subject: [File Comparison Report][File Difference] output

From: quo

Date: 20 Jun, 2005 09:17:55

Message: 2 of 2

Michael Robbins wrote:
>
>
> I'd like to do a little work with the output of a file comparison
> program. MATLAB's version is called "File Comparison Report" and
> it
> makes something labeled "File Difference."
>
> An aside here, TMW should call them both the same name.
>
> Anyway... I want to take the data and do some automated parsing on
> it. I'd like a list of changed lines, words, etc. Ideally, a
> structure like the one PROFILE makes would be great!
>
> If I could get output from a differencing program, like File
> Comparison Report, I could use it. I guess I could parse the "File
> Difference" screen since it has pretty convenient output. The line
> numbers are there and the columns have '<', '>', '.' and 'x'
> to
> identify the comparison--which is all I really need to identify the
> lines in question. Unfortunately, the lines are truncated which
> means
> I'd have to go to the original files and look up the actual text.
>
> It's doable and I will do it if I don't find an easier, better, or
> already-done solution.
>
> Any ideas are welcome.
>
> TIA

I started with visdiff.m, which is the mfile that controls the file
differences stuff in matlab. This is really nothing more than an html
constructor. (So I use this instead of trying to undo the actual
html... full lines of code are stil preserved here...) But it does
handle the output from diffcode.m, which does the actual comparison
of the 2 files provided. (Incidentally, visdiff also prepends a blank
line to the output of diffcode. This is the key to getting a correct
comparison.)

I'm working on something similar. I had some concern about others
editing my mfiles (tired of looking through thousands of lines of
code for something wrong). I looked into source control software, but
decided that I wanted something that the users wouldn't have to
interact with on any level. (Because my users would view that as a
hassle...) So I decided the easiest route to take would be to
overload the edit.m function, and am now generating reports on what
has changed over time. (The end goal is to use the report to
automatically "undo" any changes made - back to the original file.)

I'm not quite done with the project yet; but it sounds like you would
like something similar to what I've done. I'd be happy to share what
I have thus far if you're interested...

hth
-quo

Tags for this Thread

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.

rssFeed for this Thread
 

MATLAB Central Terms of Use

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 Terms prior to use.

Contact us at files@mathworks.com