I would like to load several spectra in a file.When I load one spectre I use this program:
Macro SpectreTotal(ctrlName) : ButtonControl
String list = waveList("*", ";", "")
traceName = StringFromList(0, list)
npt=pnt2x($traceName,numpnts($traceName)-1)+1 // N = numpnts(waveName)
traceName = StringFromList(1, list)
display /W=(10, 20, 600, 400) Intensity vs Wavelength
Label left "\\u#2Intensité (u.a.)";DelayUpdate
Label bottom "\\u#2longueur d'onde (A°)"
You have been asked so many times to post properly formatted code, for instructions see here:
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.
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:
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.
It is a piece of code from somewhere else... Thus the "homework" ;-)
Back to top