
Find Big Waves

RGerkin
// Returns the name of any waves exceeding 'minSize' points wherever they are found in any directory. Function FindBigWaves(minSize[,df,depth,noShow]) Variable minSize // A minimum number of points, e.g. 100000 variable depth // Used by the function recursion. Ignore. variable noShow // Don't show the table at the end. dfref df // A folder to use as the top level of the search. Default is root: if(paramisdefault(df)) dfref df=root: endif if(depth==0) NewDataFolder /O root:Packages NewDataFolder /O root:Packages:FindBigWaves dfref packageDF=root:Packages:FindBigWaves Make /o/T/n=0 packageDF:names Make /o/n=0 packageDF:sizes else dfref packageDF=root:Packages:FindBigWaves endif variable i wave /T/sdfr=packageDF names wave /sdfr=packageDF sizes variable points=numpnts(names) for(i=0;i<CountObjectsDFR(df,1);i+=1) wave w=df:$getindexedobjnamedfr(df,1,i) if(numpnts(w)>minSize) names[points]={GetWavesDataFolder(w,2)} sizes[points]={numpnts(w)} points+=1 endif endfor i=0 Do string folder=GetIndexedObjNamedfr(df,4,i) if(strlen(folder)) dfref subDF=df:$folder FindBigWaves(minSize,df=subDF,depth=depth+1) else break endif i+=1 While(1) if(depth==0) sort /R sizes,sizes,names if(!noShow) if(wintype("BigWaves")) dowindow /f BigWaves else edit /K=1 /N=BigWaves names,sizes as "Big Waves" endif endif endif End

Forum

Support

Gallery
Igor Pro 9
Learn More
Igor XOP Toolkit
Learn More
Igor NIDAQ Tools MX
Learn More
August 29, 2010 at 10:26 pm - Permalink
December 18, 2010 at 02:01 pm - Permalink
Your snipped includes this function:
This can be rewritten as:
Also, note that this will not really work for text waves, data folder reference waves, or wave reference waves. Each point of a text wave can take up a different number of bytes, depending on the length of the string that is stored in that point. You could call strlen() on each point of a text wave to get a pretty good estimate of the number of bytes the wave will take up. The SizeOfWave function also doesn't account for the size of the wave's header, but every wave header is the same size and is usually relatively small compared to the size of the wave's data.
December 20, 2010 at 02:33 pm - Permalink
I also changed the first parameter to mean size in MB instead of number of points.
May 10, 2018 at 04:21 am - Permalink