Load spectre

Dear,
I would like to load several spectra in a file.When I load one spectre I use this program:
// Spectre
//-------------------------------------------------------
Macro SpectreTotal(ctrlName) : ButtonControl
String ctrlName

KillWaves/Z Wavelength,Intensity
dowindow/K Graph0
dowindow/K Table0
LoadWave/A/G
String list = waveList("*", ";", "")
String traceName
variable i
variable/G cpix,Lgond
String/G mypath=S_path
variable/G npt

traceName = StringFromList(0, list)
npt=pnt2x($traceName,numpnts($traceName)-1)+1 // N = numpnts(waveName)
Make/O/N=(npt) Wavelength=$traceName
traceName = StringFromList(1, list)
Make/O/N=(npt) Intensity=$traceName
edit Intensity,Wavelength
display /W=(10, 20, 600, 400) Intensity vs Wavelength
ModifyGraph rgb=(0,0,0)
Label left "\\u#2Intensité (u.a.)";DelayUpdate
Label bottom "\\u#2longueur d'onde (A°)"
KillWaves/Z wave0,wave1
ShowInfo
End
Yes! Please use properly formatted code.

I really helps us to provide help.

I am rather sure that you do not know what this code is doing. This is perfectly fine for a beginner.


    However, here is some homework:
  1. Add a comment to each line what the specific line does (Here you will learn how to code !)

  2. Post the commented code in Igor tags.



    Once you are done with that, do the following:
  1. Describe your problem in a similar way (What each line of code in YOUR program should do)

  2. Read the chapter covering loops in the online help or the manual

  3. Use the lines with similar description from your posted code to produce YOUR new code

  4. Post your NEW code (with Igor tags!)



HJ
It is a little unclear what you are trying to do, and more context would be very helpful (what are graph0, table0, wave0, wave1? why are the loaded waves killed at the end?). If I guess right, it seems the user specifies two waves to load (wave0 = wavelength? wave1 = intensity?), then they are displayed in a graph (graph0?) and table (table0?). So, the my questions are:
  • What are the multiple waves you want to read in? Are they all in the same folder on disk?

  • Do you want to ask the user each time to specify each wave to read? Or does the user specify the folder, and your routine goes and finds them all?

  • Do you want to edit them all? Display them all? In the same graph/table? Each in its own?

You probably want to think about how you will specify the files you want to load. If you can get that in a list, then you can make a loop that goes through that list, and loads them in, appending to one graph, or displaying each in its own graph. Ditto with tables. If the files are not cleverly named so wavelength and intensity can be identified, that will be tricky to automate. Anyway, it would be helpful to explain the context better.

-Matthew