Taking All Waves as the Argument of a function?

Hi, I'm working on curve fitting a large collection of waves and the data comes in with an offset artifact. Since the curvefit needs the data to begin at the origin, all of the waves need to be zeroed. The function to do this is simple enough, however there are a large number of waves with different naming conventions, and it's going to be laborious to run the function for each wave individually. I'm wondering if there is some shortcut that allows me to take every wave in an experiment as the argument for a function?

Function(AllWaves)
wave=wave_i
wave-=wave[0]
End
You will need to send the wave list in as a string, with each wave separated by semicolons or another marker, and then use a loop to iterate through the list and apply your adjustments to the wave.

Here's a function that will return such a string from a selection in the Data browser

Function/S SelectedWaveList() //all selected waves...
    string SelectedWaves=""
    variable i
    do
        if(waveexists($(GetBrowserSelection(i))))
            SelectedWaves+=GetBrowserSelection(i)+";"
        endif
        i+=1
    while(strlen(GetBrowserSelection(i))>0)
    return SelectedWaves
end


Using this, you can create a function that will accept the returned list as an input, which you can parse and act upon, such as the following:

Function ParseList(list)
    string list

    variable i
    for(i=0;i<itemsinlist(list);i+=1)
        WAVE wavenm=$stringfromlist(i,list,";")
        wavenm=//modify the wave here
    endfor
end


To run these, you would then do the following:

1. Make a selection in the Data Browser
2. Run the following command:

ParseList(SelectedWaveList())
The idea of using the Data Browser is good if you want to pick and choose the waves to operate on. However if you truly want to apply this to all numeric waves then I would write the function to work on all of the numeric waves in the current data folder, like this:

Function SubtractInitialValueFromWaves(dfr, recurse)
    DFREF dfr               // : for current data folder
    Variable recurse            // 0 for just specified data folder, 1 to recurse through sub-data folders
   
    Variable index = 0
    do
        Wave/Z w = WaveRefIndexedDFR(dfr, index)        // Requires Igor Pro 6.30 or later
        if (!WaveExists(w))
            break                           // No more waves in this data folder
        endif
        if (WaveType(w) != 0)               // Numeric wave?
            Variable initialValue = w[0]        // This must be done
            w -= initialValue                   // in two separate statements
        endif
        index += 1
    while(1)
   
    if (recurse)
        Variable numChildDataFolders = CountObjectsDFR(dfr, 4)
        Variable i
        for(i=0; i<numChildDataFolders; i+=1)
            String childDFName = GetIndexedObjNameDFR(dfr, 4, i)
            DFREF childDFR = dfr:$childDFName
            SubtractInitialValueFromWaves(childDFR, 1)
        endfor
    endif
End

I know this isn't directly related to your question, but if your data has an offset, why not simply add an offset coefficient to your curve fit?