LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LVcompare for multiple vi

I have two folders with the same files.  I want to compare the files in folder 1 with the files in folder 2 and see what vi are different.  How do I do that?  I have the concerns below.

 

1. The files in folder 1 and the files in folder 2 have identical names.  They can't all be in memory for comparison.  Is that a valid problem?

2. Can comparison be done on multiple files?  

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 1 of 9
(4,409 Views)

The easiest way to compare the two would be to place all of the code into projects and name the projects differently. You will be able to compare the VIs then since their names will include the project scope. You may run into an issue if you are calling shared code that is not in the project. Code that is not in the project with the same name will only load the first instance which is loaded. I am not sure about comparing multiple files. Are you referring to multiple copies of the same VI or simply having the results of multiple compares visiable at the same time?



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 2 of 9
(4,396 Views)

By mutiple files, I meant multiple files in one folder vs. multiple files in another folder.  The name of files for two folders are identical.

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 3 of 9
(4,354 Views)

One question, based on your posts:

 

Are you looking for exactly identical VIs, identical VIs except for revision number (and/or revision comments), or VIs which have the same functionality but could be different internally?

 

If you want identical ro essentially identical VIs, you could get the size of each VI in the two folders in a simple directory listing of each and those with identical names but very different sizes between folders are obviously different, for a first screen. Those which have the same size down to the kb level (directory) could be examined individually by getting the file "size" properties. Those which have exactly the same size are likely to be identical (but this would have to be tested to be sure).

 

Cameron

 

To err is human, but to really foul it up requires a computer.
The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
Profanity is the one language all programmers know best.
An expert is someone who has made all the possible mistakes.

To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):

LabVIEW Unit 1 - Getting Started</ a>
Learn to Use LabVIEW with MyDAQ</ a>
Message 4 of 9
(4,348 Views)

The way I solved this problem was, of course, to write a LabVIEW program.  My program took, as parameters, two top-level folders, each holding the tree of VIs (in identically-named folders and having identically-named VIs) I wanted to compare.  My routine parsed the directory trees, shunted off those files that were unique to the first and second folder, then "only" had to compare identically-named VIs that were common to the two folders.

 

Well, the native LVCompare wants to compare two VIs with different names.  So I simply added the suffix ".tmp" to the end of the filename from the second folder, did the compare, then renamed the file back again.  For example, if I'm supposed to compare "Close File.vi" from the first tree to "Close File.vi" from the second tree, I rename the second file "Close File.tmp.vi", do the compare, then rename the file back to "Close File.vi".

Message 5 of 9
(4,325 Views)

VI with same functionalities, but could be different internally.  The size of the vi are the same, since it could be a minor code change.

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 6 of 9
(4,297 Views)

so your problem will use LVCompare in a loop that loop thought all files in a folder?  I was hoping that this is a native function in LabVIEW.

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 7 of 9
(4,295 Views)

@jyang72211 wrote:

VI with same functionalities, but could be different internally.  The size of the vi are the same, since it could be a minor code change.


If all you want to do is compare two VIs to see if they are identical or not, that's fairly easy.  There would be no problem opening files with identical names (but different paths).  This VI tests, first, if the files have the same size, and if they do, it then does a "byte compare" between them simply by reading them and asking if the "arrays of bytes" are the same or different.

 

Are Files Identical.png

Message 8 of 9
(4,279 Views)

@jyang72211 wrote:

VI with same functionalities, but could be different internally.  The size of the vi are the same, since it could be a minor code change.


Well, in that case the only thing you can do is set up a test scheme for each group and test them. A "minor code change" can often produce a major output change with the right set of inputs.

 

BTW, I would be surprised if any significant number of VIs with "minor code changes" would be the same size down to the byte level (as you would get by looking at the file size property, not just perusing a directory). The same number of kilobytes (directory listing), sure, but not all the way down.


Cameron

 

To err is human, but to really foul it up requires a computer.
The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
Profanity is the one language all programmers know best.
An expert is someone who has made all the possible mistakes.

To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):

LabVIEW Unit 1 - Getting Started</ a>
Learn to Use LabVIEW with MyDAQ</ a>
Message 9 of 9
(4,274 Views)