Load All Matrix Files From Folder

Menu "Load Waves"
    "Load All .dat Matrix Files From Folder", LoadAllMatrixFilesFromFolder("", ".dat", 0)

//  LoadAllMatrixFilesFromFolder(pathName, extension, makePlots)
//  This function loads each matrix file in a given file folder into Igor.
//  pathName is the name of an Igor symbolic path or "" to get a dialog.
//  The name of each matrix file is assumed to end with the specified file name extension.
//  The output wave name is the file name less the extension.
//  If makePlots is true, a new image plot is created for each matrix.
//  NOTE: You may need to change the LoadWave command to fit your file format.
//  Use Data->Load Waves->Load Waves to find the right command and then adjust the LoadWave command below.

Function LoadAllMatrixFilesFromFolder(pathName, extension, makePlots)
    String pathName             // Name of an Igor symbolic path or "" to get a dialog
    String extension                    // File name extension - e.g., "txt" or ".dat"
    Variable makePlots              // 1 to display each matrix in a plot
    if (strlen(pathName) == 0)
        NewPath/O/M="Choose a folder containing Matrix Files" LoadIndexedMatrixPath
        if (V_flag != 0)
            return -1               // User cancelled
        pathName = "LoadIndexedMatrixPath"
    String fileName
    Variable index
    index = 0
        fileName = IndexedFile($pathName, index, extension)
        if (strlen(fileName) == 0)
            break           // No more files.
        String matrixName = CleanupName(fileName, 0)
        Variable existsCode = exists(matrixName)
        if (existsCode!=0 && existsCode!=1)
            // matrixName conflicts with some name other than a wave name so make it unique
            matrixName = UniqueName(matrixName, 1, 0)
        String columnInfoStr
        sprintf columnInfoStr, "N='%s';", matrixName
        LoadWave/G/D/P=$pathName/O/M/B=columnInfoStr fileName
        Wave matrix = $matrixName           // Create a wave reference
        if (makePlots)
            NewImage matrix
        index += 1
    while (1)

It is the very procedure I am now seeking. My matrix files (.spe) are generated by Princeton Instruments Camera.
I understand that I have to load .spe files instead of .dat by using this useful procedure "Load All .dat Matrix Files From Folder", and I also noticed that there was a procedure "Winspec.ipf" or "SpeLoader.ipf" available.It can help load .spe files. http://www.igorexchange.com/node/2756
My question here is how to combine these two together to get a new procedure to directly load .spe files. Many thanks.

Make some changes before you have to.




Igor Pro 9

Learn More

Igor XOP Toolkit

Learn More

Igor NIDAQ Tools MX

Learn More