
Loading spectroscopic data into igor from general text

McIlhenny
I've to load a ascii file with x and y waves into igor. A typical file looks like:
Area1
SUR
1
1399.0000,7242.7033
1398.2000,8228.6017
1397.4000,7379.5712
1396.6000,7491.0938
1395.8000,7897.0668
1395.0000,7162.2372
1394.2000,7876.3272
1393.4000,7402.1067
1392.6000,7568.9746
Area1
N1s
1
408.0000,101.1882
407.9500,101.3558
407.9000,96.7365
407.8500,96.9283
407.8000,94.1598
407.7500,94.8345
407.7000,95.6612
407.6500,95.3786
407.6000,94.0064
407.5500,95.0241
407.5000,98.0092
407.4500,99.6761
There are several of such datablocks with different numbers of rows in my ascii file. Each datablock begins with "Area1" followed by a free line and some information from the spectra "SUR, N1s ....". The real data starts after the "1".
Now I want igor to load the data and give the waves special names. Let's say the ascii file is called "Spec1.txt". Then all the xwaves should have the prefix "Spec1_EB_" and all the y waves should be named like "Spec1_Int_". After the last underscore I want to have some data from the header in the wavename. In my example I want the waves to be named "Spec1_EB_SUR", "Spec1_Int_SUR" for the first block and "Spec1_EB_N1s", "Spec1_Int_N1s" for the second block.
My igor skills so far are not good enough to get this job done. I don't want you to give me the total code for this. I'm satisfied with some hints so I can learn how to do this.
Thanks in advance.
April 29, 2012 at 12:55 pm - Permalink
April 30, 2012 at 07:31 am - Permalink
Please forgive my ignorance, but this has been bothering me for a while today. If each line in the text file has a "\r" at the end of the line, how will the following if statement return a true value?
I have the same question for finding the end of a text file. Is there a simple way to determine the end of a file?
Thanks for your help!
June 19, 2013 at 08:27 am - Permalink
June 19, 2013 at 09:04 am - Permalink
June 19, 2013 at 09:42 am - Permalink