
Batch File Graph Analysis

bls44
I've written a code that creates an index to batch analyze graphs from a folder. Each graph in the designated folder has it's own multidimensional matrix, so ideally I should be able to display and analyze each graph before the index (and consequently the loaded file) changes. I've run across a few issues, however. The largest is that the entirety of each loaded matrix is only 1 wave, so I preferably want to be able to make a wave out each column for further graphical analysis. For instance, I want matrix[][1] to be labeled 'wave1'. To do this, I tried the duplicate command to apply the appropriate data from matrix[][1] to 'wave1' and from matrix[][2] to 'wave2'. Then, I did Display wave1 vs wave 2. After running, all 15 displayed graphs came out looking the same and using the last loaded images matrix data. What's weird is I looked at the data in wave1 & 2 while running and all of the values were different, so it must just be an issue with display during iteration. Any help is appreciated.
Function BatchGraphAnalysis(pathName, extension, makePlots) String pathName // Use "" to get a dialog String extension // File name extension, use ".ibw" 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 endif pathName = "LoadIndexedMatrixPath" endif String fileName Variable index index = 0 do fileName = IndexedFile($pathName, index, extension) if (strlen(fileName) == 0) break // No more files. endif String matrixName = CleanupName(fileName, 0) matrixName = ParseFilePath(0, fileName, ".", 0, 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) endif String columnInfoStr sprintf columnInfoStr, "N='%s';", matrixName LoadWave/M/D/O/P=$pathName/B=columnInfoStr fileName wave matrix = $matrixName duplicate/o/R=[*][1] matrix, wave1 duplicate/o/R=[*][2] matrix, wave2 display wave1 vs wave2 index += 1 while (1) End
http://www.igorexchange.com/node/7799
This seems to be a similar issue.
July 18, 2017 at 11:29 pm - Permalink
In this part of the code, you load a wave
matrix
and you copy the coulmn data intowave1
andwave2
.But on the next iteration
wave1
andwave2
will be overwritten with the data from the newly loadedmatrix
.You can think of graphs in Igor as visual representations of the waves. So if you do something like this:
you will see that the graphs will update at every iteration (hopefully), displaying the same graph at each step of the loop.
The best solution would have been to do this, but Igor cannot handle slices, thus the
/R
specifier on a few Igor operations:You can try loading each wave slice with a unique name:
I am not sure this is the best way, however.
best,
_sk
July 19, 2017 at 12:28 am - Permalink
July 19, 2017 at 08:40 am - Permalink