 
    
    
    
    Compare all waves in two folders to check for inequality.
As the title says, below function takes in two folders as data folder reference, one reference folder DF1 and one folder to compare DF2. It then goes through all the waves and checks every aspect of each wave and prints a message if a discrepancy was found. This is useful, e.g., to check against a backup folder with a ton of waves to see what is different. If the compared folder contains new waves, this is printed as well. The total number of discrepancies is returned. The optional parameter StopAtFirst can be used to suppress multiple messages for the same wave in case there exist several differences. The function is not searching recursive in sub-folders and does not look for strngs, variables etc. (this could be added easily if necessary).
Function CheckAllWavesForEquality(DFREF DF1, DFREF DF2, [int StopAtFirst]) StopAtFirst = ParamIsDefault(StopAtFirst) ? 0 : StopAtFirst int numMismatch = 0 string list = WaveList("*",";","",DF1) string what = "data;data type;scaling;units;dim unit;dim label;note;lock state;full scale;dim size;" for(string cur : ListToTextWave(list,";")) WAVE/Z/SDFR=DF1 w1 = $cur WAVE/Z/SDFR=DF2 w2 = $cur if (!WaveExists(w2)) Printf "Wave '%s' does not exist in folder '%s'.\r", cur, GetDataFolder(0, DF2) numMismatch++ continue endif for(string chk : ListToTextWave(what,";")) if (!EqualWaves(w1, w2, 2^WhichListItem(chk,what))) Printf "The %s is different for wave '%s'.\r", chk, cur numMismatch++ if (StopAtFirst) break endif endif endfor endfor list = RemoveFromList(list, WaveList("*",";","",DF2)) if (strlen(list)) Printf "The following Waves do not exist in folder '%s': %s.\r", GetDataFolder(0, DF1), ReplaceString(";", RemoveEnding(list,";"), ", ") endif return numMismatch + ItemsInList(list) End
 
        Forum
 
        Support
 
        Gallery
Igor Pro 10
Learn More
Igor XOP Toolkit
Learn More
Igor NIDAQ Tools MX
Learn More

