Print Data Listing

Prints a listing of data folders and waves and their sizes to the history area.

Menu "Macros"
    "Print Data Listing", PrintDataListing(root:, 0, 0, 1)
End

// PrintDataListing(dfr, minWaveNumBytes, level, recurse)
// 
//  Prints a listing of data folders and waves and their sizes to the history area.
// Numeric and string variables are ignored.
//
// NOTE: In a very large experiment, this can take a long time.
//
// Example:
//      PrintDataListing(root:, 0, 0, 1)    // Print all waves in root and all sub-data folders
//
// Waves that consume fewer than minWaveNumBytes are skipped. For example, to list only
// waves containing 10 million bytes or more, pass 10E6 for minWaveNumBytes.
Function PrintDataListing(dfr, minWaveNumBytes, level, recurse)
    DFREF dfr
    Variable minWaveNumBytes            // Waves with fewer bytes are skipped
    Variable level
    Variable recurse

    String indentation = ""
    Variable i
    for(i=0; i<level; i+=1)
        indentation += "  "
    endfor
   
    String dfPath = GetDataFolder(1, dfr)
    String dfName = GetDataFolder(0, dfr)
   
    String listing = ""
    String temp
    Variable numBytesForAllWavesInDF = 0
   
    Variable index = 0
    do
        Wave/Z w = WaveRefIndexedDFR(dfr, index)
        if (!WaveExists(w))
            break
        endif
        String path = GetWavesDataFolder(w, 2)
        String info = WaveInfo(w,0)
        Variable numBytes = NumberByKey("SIZEINBYTES", info)
        if (numBytes >= minWaveNumBytes)
            sprintf temp, "%s    %s, wave bytes=%d\r", indentation, path, numBytes
            listing += temp
            numBytesForAllWavesInDF += numBytes
        endif
        index += 1
    while(1)
   
    sprintf temp, "%sData Folder: %s, data folder bytes=%d\r", indentation, dfPath, numBytesForAllWavesInDF
    listing = temp + listing
    Printf "%s", listing
   
    if (recurse)
        Variable numChildDataFolders = CountObjectsDFR(dfr, 4)
        for(i=0; i<numChildDataFolders; i+=1)
            String childDFName = GetIndexedObjNameDFR(dfr, 4, i)
            DFREF childDFR = dfr:$childDFName
            level += 1
            PrintDataListing(childDFR, minWaveNumBytes, level, 1)
        endfor
    endif
End

 

 

Forum

Support

Gallery

Igor Pro 9

Learn More

Igor XOP Toolkit

Learn More

Igor NIDAQ Tools MX

Learn More