Find no-longer-relevant waves in Current Data Folder
Mon, 08/31/2020 - 04:23 am
Here is a utility I created to remedy my poor coding practices. I often use a pxp as a stating point for a modified version with different purpose or code structure, without being careful to kill unnecessary waves, as new waves are created. This code finds waves in the Data Browser's current data folder that are not created in any of the specified Procedure files. It lists their names and sizes, but does NOT kill them, since useful waves may have been imported. It has been tested in Windows 10 using the root data folder.
String mytext= ProcedureText("",-1,"Procedure")+ProcedureText("",-1,"Setup")+ProcedureText("",-1,"Propagate")
// a long text of specified procedures used to search for wvs
String list=WaveList("*",";","") // all waves in CDF
String separator = ";"
Variable separatorLen = strlen(separator)
Variable numItems = ItemsInList(list)
Variable offset = 0
for(i=0; i<numItems; i+=1)
// When using offset, the index parameter is always 0
item = StringFromList(0, list,separator,offset)
vSize = NumberByKey("SIZEINBYTES",WaveInfo($item,0))/1000 // in KBytes
if(strsearch(mytext,item, -1,2)==-1) // not found in procedures
print item, vSize, strsearch(mytext,item, -1,2) // item not in not in any proc window
offset += strlen(item) + separatorLen
You should modify the "mytext" specification, which concatenates the specified procedures to be searched, or pass their string variables into the function.
Igor Pro 9
Igor XOP Toolkit
Igor NIDAQ Tools MX