Add different columns in to different graphs
Payam
I am very new in Igore. I have XAS data, I need to select two columns of these data and plot them in separate graphs, and there are 100 separate data files. I attached one of them and you can see that there are different columns and I want to choose the first and 8th columns and again first and 9th columns , then plot them. I wrote some stuff and you can see them below, I could write some commands to open a new window and insert the path of the data but I have no idea how to choose those columns and how to plot them!!! other columns should be ignored.
Thank you in advance
*****************************************************************
Menu "Payam"
"Load1011XAS", XAS1011("",0,0)
end
function XAS1011(basename,first,last)
string basename
variable first,last
prompt basename,"Specify the basename of the files to be loaded (filename format: basenameXXXX)"
prompt first,"Number of the first spectrum to load"
prompt last,"Number of the last spectrum to load"
doprompt "Load settings",basename,first,last
silent 1
string name,EkinName,SpectrumName,SpectrumName1,WavesToBeKilled,WaveToBeKilled,WavesToBeRenamed,WaveToBeRenamed
variable i=first,j
NewPath /M="Choose data directory"/O DataPath
if(!DataFolderExists("root:Data"))
NewDataFolder/S root:Data
else
SetDataFolder root:Data
endif
do //Find wavename
name=basename+num2str(i)+".sx7"
if(i<100)
name=basename+"0"+num2str(i)+".sx7"
endif
if (i<10)
name=basename+"00"+num2str(i)+".sx7"
endif
i+=1
while(i end
If you have not already done it I recommend putting your current task aside and doing the first half of the Igor guided tour. It is essential. Choose Help->Getting Started.
Once you have done that ...
I'm not sure that I understand what you want to do but I have pasted below an attempt at doing it.
Before trying this you must create an Igor symbolic path pointing to the folder containing the files. You need to first understand what that is so execute this command and read the help:
String pathName // Name of Igor symbolic path
String baseFileName
Variable firstFileIndex, lastFileIndex
NewDataFolder/O/S root:Data
Variable i
for(i=firstFileIndex; i<=lastFileIndex; i+=1)
// Create names for waves
String xName
sprintf xName, "X%04d", i // e.g., X0000
String aName
sprintf aName, "A%04d", i // e.g., A0000
String bName
sprintf bName, "B%04d", i // e.g., B0000
// Create parameter for LoadWave/B flag
String columnInfo = ""
columnInfo += "N=" + xName + ";"
columnInfo += "C=6,N='_skip_';" // Skip 6 columns
columnInfo += "N=" + aName + ";"
columnInfo += "N=" + bName + ";"
columnInfo += "C=100,N='_skip_';" // Skip all remaining columns
// Load the waves
String fileName
sprintf fileName, "%s%04d.sx7", baseFileName, i
LoadWave/G/P=$pathName/B=columnInfo/A/O fileName // Sets S_waveNames to list of wave names
// Create references for the waves loaded
String name
name = StringFromList(0, S_waveNames)
Wave xWave = $name
name = StringFromList(1, S_waveNames)
Wave aWave = $name
name = StringFromList(2, S_waveNames)
Wave bWave = $name
// Create graph
String graphName
sprintf graphName, "PayamGraph%d", i
if (WinType(graphName) == 0) // Graph does not already exist?
Display/N=graphName aWave vs xWave as graphName
AppendToGraph bWave vs xWave
endif
endfor
End
August 18, 2014 at 12:19 pm - Permalink